downforacross / downforacross.com

Web frontend for downforacross.com -- continuation of stevenhao/crosswordsio
https://downforacrosscom.downforacross1.now.sh
MIT License
220 stars 92 forks source link

Fencing mode broken due to initialization of `clock.trueTotalTime` #258

Open menonsamir opened 1 year ago

menonsamir commented 1 year ago

I think that Fencing is currently breaking in some cases because the clock.trueTotalTime property on the game object is missing from the server-initialized game state. In server/model/game.ts#L67:

clock: {
    lastUpdated: 0,
    totalTime: 0,
    paused: true,
}

A bunch of other code assumes that the trueTotalTime property is already initialized. Specifically, in src/lib/wrappers/HistoryWrapper.js#L114:

event.gameTimestamp = this.getSnapshotAtIndex(insertPoint).clock.trueTotalTime;

I think a one-line addition of trueTotalTime: 0 to addInitialGameEvent would fix it, though I haven't tested it.

stevenhao commented 1 year ago

oh yeah good catch. will look into it next time i have a chance