Implement Playlist Statistics - #904
Conversation
jvyden
left a comment
There was a problem hiding this comment.
With the statistics system, it's important to keep track of the versioning as it's how Refresh knows when to update objects. Without bumping them with schema changes they will be out of date and will never catch up unless marked dirty.
I think I implemented it so that Refresh serves old data while a worker updates everything in the background.
| { | ||
| [Required, Key] public int PlaylistId { get; set; } | ||
| public DateTimeOffset? RecalculateAt { get; set; } = null; | ||
| public int Version { get; set; } = GameDatabaseContext.LevelStatisticsVersion; |
There was a problem hiding this comment.
Should use the new PlaylistStatisticsVersion
| } | ||
|
|
||
| #region Levels | ||
| internal const int LevelStatisticsVersion = 2; |
There was a problem hiding this comment.
Should be bumped to 3 so game server knows to upgrade the statistics. Same with UserStatisticsVersion, since we also modify that table.
|
I just noticed that statistics for deleted levels/users don't get deleted and stay in the database. Is that intentional? |
|
Very unexpected. Are they not being cascade deleted? |
|
Doesn't seem like it. They don't have |
|
I'll make an issue to track this. |
Adds playlist statistics, which work similarly to level and user statistics. Also slightly optimizes some playlist database methods and groups a few of them together to hopefully make them easier to follow.