Skip to content

Commit 5cc7fde

Browse files
committed
Fix timeout not cleared on BaseScene, TimeLimit in seconds in DB
1 parent 2dbe917 commit 5cc7fde

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

app/model/Participant.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,18 @@ def setGroup(self, newGroup: str, timeStamp: Union[str, int]):
310310
def startGame(self, timeStamp: int):
311311
self.logger.writeToLog(EventType.PhaseRequested, '§Scene: PreloadScene', timeStamp)
312312

313-
globalLimit = self.getGlobalTimerDuration(TIMER_NAME_GLOBAL_LIMIT)
314-
globalLimit = globalLimit if globalLimit > 0 else None
313+
globalLimit = self.getGlobalTimerDuration(TIMER_NAME_GLOBAL_LIMIT) # ms
314+
globalLimit = globalLimit/1000 if globalLimit > 0 else None
315315

316316
event = ChronoEvent(
317317
clientTime=timeStamp,
318318
serverTime=now(),
319319
pseudonym=self.pseudonym,
320-
phase='PreloadScene',
320+
phase=PhaseType.Preload,
321321
level=None,
322322
operation='start',
323323
timerType='phase',
324-
context='PreloadScene',
324+
context=PhaseType.Preload,
325325
limit=globalLimit
326326
)
327327
event.commit()

static/src/scenes/BaseScene.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class BaseScene extends Phaser.Scene
357357
}
358358

359359
// Que the countdown message, it will be send later by show()
360-
JsonRPC.que("chrono", ["countdown", this.phase, "start", Rq.now()]);
360+
JsonRPC.que("chrono", ["countdown", this.phase, "start", Rq.now(), this.timerDuration/1000]);
361361
console.log("Time: " + this.timerDuration/1000 + " seconds remaining until " + advTimerName + ".");
362362
}
363363

@@ -471,6 +471,10 @@ class BaseScene extends Phaser.Scene
471471
*/
472472
cleanUp()
473473
{
474+
// First make sure no countdown fires during cleanup
475+
this.stopCountdown();
476+
477+
// Remove all Click Listeners
474478
for(const e of this.eventList)
475479
this.input.removeListener(e);
476480

static/src/scenes/GameScene.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,6 @@ ${textYourScore} ${this.level.stats.score.toString()} / 100
926926
cleanUp()
927927
{
928928
try {this.timerReminderText.destroy();} catch {}
929-
this.stopCountdown();
930929
super.cleanUp();
931930
}
932931
}

0 commit comments

Comments
 (0)