Skip to content

Commit

Permalink
Handle null levels in certain categories
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Oct 20, 2023
1 parent 42704b1 commit dbd2959
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Refresh.GameServer/Database/GameDatabaseContext.Levels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public DatabaseList<GameLevel> GetMostHeartedLevels(int count, int skip, TokenGa
.Select(g => new { Level = g.Key, Count = g.Count() })
.OrderByDescending(x => x.Count)
.Select(x => x.Level)
.Where(l => l != null)
.Where(l => l._Source == (int)GameLevelSource.User)
.FilterByGameVersion(gameVersion);

Expand All @@ -173,6 +174,7 @@ public DatabaseList<GameLevel> GetMostUniquelyPlayedLevels(int count, int skip,
.Select(g => new { Level = g.Key, Count = g.Count() })
.OrderByDescending(x => x.Count)
.Select(x => x.Level)
.Where(l => l != null)
.Where(l => l._Source == (int)GameLevelSource.User)
.FilterByGameVersion(gameVersion);

Expand All @@ -190,6 +192,7 @@ public DatabaseList<GameLevel> GetMostReplayedLevels(int count, int skip, TokenG
.Select(g => new { Level = g.Key, Count = g.Sum(p => p.Count) })
.OrderByDescending(x => x.Count)
.Select(x => x.Level)
.Where(l => l != null)
.FilterByGameVersion(gameVersion);

return new DatabaseList<GameLevel>(mostPlayed, skip, count);
Expand All @@ -206,6 +209,7 @@ public DatabaseList<GameLevel> GetHighestRatedLevels(int count, int skip, TokenG
.Select(g => new { Level = g.Key, Karma = g.Sum(r => r._RatingType) })
.OrderByDescending(x => x.Karma) // reddit moment
.Select(x => x.Level)
.Where(l => l != null)
.Where(l => l._Source == (int)GameLevelSource.User)
.FilterByGameVersion(gameVersion);

Expand Down

0 comments on commit dbd2959

Please sign in to comment.