From 89ab8d4573c665fa3cfc5eac470d87bfa9610005 Mon Sep 17 00:00:00 2001 From: sbeltranc Date: Mon, 16 Feb 2026 20:16:12 -0500 Subject: [PATCH] push push push spsuh push psuh --- backend/package.json | 2 +- backend/scripts/reset-projects.ts | 8 -------- backend/src/routes/shop.ts | 11 ++++++++--- 3 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 backend/scripts/reset-projects.ts diff --git a/backend/package.json b/backend/package.json index 02956a8..a5b6ee7 100644 --- a/backend/package.json +++ b/backend/package.json @@ -2,7 +2,7 @@ "name": "app", "version": "1.0.50", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "bun test", "dev": "bun run --watch src/index.ts", "start": "bun run src/index.ts" }, diff --git a/backend/scripts/reset-projects.ts b/backend/scripts/reset-projects.ts deleted file mode 100644 index 673e517..0000000 --- a/backend/scripts/reset-projects.ts +++ /dev/null @@ -1,8 +0,0 @@ -import 'dotenv/config' -import { drizzle } from 'drizzle-orm/node-postgres' -import { sql } from 'drizzle-orm' - -const db = drizzle(process.env.DATABASE_URL!) - -await db.execute(sql`DROP TABLE IF EXISTS projects CASCADE`) -console.log('Dropped projects table') diff --git a/backend/src/routes/shop.ts b/backend/src/routes/shop.ts index 16f6914..b734fe4 100644 --- a/backend/src/routes/shop.ts +++ b/backend/src/routes/shop.ts @@ -953,12 +953,18 @@ shop.post('/items/:id/refinery/undo', async ({ params, headers }) => { const order = orders[0] - // Delete the order (balance is calculated dynamically, so deleting this removes the cost from the spent total) await db .delete(refineryOrdersTable) .where(eq(refineryOrdersTable.id, order.id)) - // Get updated boost and upgrade count + await db + .delete(refinerySpendingHistoryTable) + .where(and( + eq(refinerySpendingHistoryTable.userId, user.id), + eq(refinerySpendingHistoryTable.shopItemId, itemId), + eq(refinerySpendingHistoryTable.cost, order.cost) + )) + const boost = await db .select({ boostPercent: sql`COALESCE(SUM(${refineryOrdersTable.boostAmount}), 0)`, @@ -974,7 +980,6 @@ shop.post('/items/:id/refinery/undo', async ({ params, headers }) => { const newUpgradeCount = boost.length > 0 ? Number(boost[0].upgradeCount) : 0 const refundedCost = order.cost - // Get penalty for effective probability calculation const penalty = await db .select({ probabilityMultiplier: shopPenaltiesTable.probabilityMultiplier }) .from(shopPenaltiesTable)