From b251304b4d48a62334b787ceb956a7e46aa52d66 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Feb 2026 00:48:33 +0000 Subject: [PATCH] Fix rollback to not touch timers at all Timers are each team's time bank and should not be affected by rolling back a pick. The previous code (both original and the first fix) was deleting all timer rows during rollback, which was the actual root cause of the missing timer bug. Rollback now only does what it should: delete picks from the rollback point onwards and reset currentPickNumber. The timer system will naturally resume for the correct team on its next tick. Also removes the incorrect timer-update socket emit that was sending initialTime instead of the team's actual remaining bank. https://claude.ai/code/session_01YPxgcQywG57KiXj7m46gLV --- app/routes/api/draft.rollback.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/app/routes/api/draft.rollback.ts b/app/routes/api/draft.rollback.ts index b9e4823..363102e 100644 --- a/app/routes/api/draft.rollback.ts +++ b/app/routes/api/draft.rollback.ts @@ -75,21 +75,6 @@ export async function action(args: any) { ) ); - // Clear all timers and recreate them for every team so no team is left without a timer - await db - .delete(schema.draftTimers) - .where(eq(schema.draftTimers.seasonId, seasonId)); - - const initialTime = season.draftInitialTime || 120; - - await db.insert(schema.draftTimers).values( - draftSlots.map((slot) => ({ - seasonId, - teamId: slot.teamId, - timeRemaining: initialTime, - })) - ); - // Update season: reset pick number and unpause await db .update(schema.seasons) @@ -108,15 +93,6 @@ export async function action(args: any) { pickNumber, teamId: rollbackSlot?.teamId, }); - - if (rollbackSlot) { - io.to(`draft-${seasonId}`).emit("timer-update", { - seasonId, - teamId: rollbackSlot.teamId, - timeRemaining: initialTime, - currentPickNumber: pickNumber, - }); - } } catch (error) { console.error("Socket.IO error:", error); }