File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ __pycache__
66.coverage
77picturedata.txt
88node_modules /
9- dist /
9+ dist /
10+ .codex /
Original file line number Diff line number Diff line change @@ -151,7 +151,17 @@ export class DailyService {
151151 const now = new Date ( ) ;
152152 await prisma . userDaily . upsert ( {
153153 where : { username } ,
154- update : { startedAt : now } ,
154+ // Reset per-day fields when starting a new day.
155+ // This prevents a previous-day timeout state (played=true + null guess) from blocking submissions
156+ // after we update startedAt for the new day.
157+ update : {
158+ startedAt : now ,
159+ played : false ,
160+ points : 0 ,
161+ distance : 0 ,
162+ guessLat : null ,
163+ guessLng : null
164+ } ,
155165 create : {
156166 username,
157167 startedAt : now
@@ -188,7 +198,12 @@ export class DailyService {
188198 // Check if timed out today (startedAt is today, guessLat is null, AND played is true)
189199 // This handles the case where user timed out but we didn't set lastPlayed
190200 // We must check played === true to distinguish from users who started but haven't submitted yet
191- if ( userDaily . startedAt && userDaily . guessLat === null && userDaily . played === true ) {
201+ if (
202+ userDaily . startedAt &&
203+ userDaily . played === true &&
204+ userDaily . guessLat === null &&
205+ userDaily . guessLng === null
206+ ) {
192207 const startedAt = new Date ( userDaily . startedAt ) ;
193208 startedAt . setHours ( 0 , 0 , 0 , 0 ) ;
194209 if ( startedAt . getTime ( ) === today . getTime ( ) ) {
You can’t perform that action at this time.
0 commit comments