You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been many bugs related to playattempts, and they are always very complex to debug. Even after resolving many bugs and polishing the APIs, the logic is still difficult to understand. Playattempt bugs have almost always been caused by the existence of attemptContext (playattempts are out of order, time range overlap because of extending the wrong playattempt, etc).
Additionally, 30% of the existing playattempt documents have attemptContext BEATEN with identical startTime and endTime, meaning there is a large amount of useless data stored due to attemptContext.
Proposal
Remove attemptContext from playattempts and instead use the ts field from statmodel to calculate play time. startTime and endTime can probably even be removed from playattempts and instead be automatically handled by createdAt and updatedAt (incrementing updateCount will set updatedAt).
Although this makes playattempts simpler and avoids possible bugs, it makes queries related to total play time more difficult. Instead of calculating endTime - startTime for all non-BEATEN playattempts, you'll have to find all playattempts where startTime < level completion time, and make sure to cut any playattempts that cross over a level completion time.
The text was updated successfully, but these errors were encountered:
Motivation
There have been many bugs related to playattempts, and they are always very complex to debug. Even after resolving many bugs and polishing the APIs, the logic is still difficult to understand. Playattempt bugs have almost always been caused by the existence of attemptContext (playattempts are out of order, time range overlap because of extending the wrong playattempt, etc).
Additionally, 30% of the existing playattempt documents have attemptContext BEATEN with identical startTime and endTime, meaning there is a large amount of useless data stored due to attemptContext.
Proposal
Remove attemptContext from playattempts and instead use the ts field from statmodel to calculate play time. startTime and endTime can probably even be removed from playattempts and instead be automatically handled by createdAt and updatedAt (incrementing updateCount will set updatedAt).
Although this makes playattempts simpler and avoids possible bugs, it makes queries related to total play time more difficult. Instead of calculating endTime - startTime for all non-BEATEN playattempts, you'll have to find all playattempts where startTime < level completion time, and make sure to cut any playattempts that cross over a level completion time.
The text was updated successfully, but these errors were encountered: