Prevent LBP3 reviews from showing up in LBP2 (#1015)

This commit is contained in:
Josh 2024-04-28 20:44:41 -05:00 committed by GitHub
commit ed5bb5d769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 113 additions and 0 deletions

View file

@ -157,6 +157,13 @@ public class ReviewController : ControllerBase
List<GameReview> reviews = (await this.database.Reviews
.Where(r => r.SlotId == slotId)
.Select(r => new
{
Review = r,
SlotVersion = r.Slot!.GameVersion,
})
.Where(a => a.SlotVersion <= token.GameVersion)
.Select(a => a.Review)
.OrderByDescending(r => r.ThumbsUp - r.ThumbsDown)
.ThenByDescending(r => r.Timestamp)
.ApplyPagination(pageData)
@ -178,6 +185,13 @@ public class ReviewController : ControllerBase
List<GameReview> reviews = (await this.database.Reviews
.Where(r => r.ReviewerId == targetUserId)
.Select(r => new
{
Review = r,
SlotVersion = r.Slot!.GameVersion,
})
.Where(a => a.SlotVersion <= token.GameVersion)
.Select(a => a.Review)
.OrderByDescending(r => r.Timestamp)
.ApplyPagination(pageData)
.ToListAsync()).ToSerializableList(r => GameReview.CreateFromEntity(r, token));