From 096a477d0d2c5351642ed7b4f0fe9a1906d4a94e Mon Sep 17 00:00:00 2001 From: Slendy Date: Mon, 5 Sep 2022 05:49:20 -0500 Subject: [PATCH] Clamp review thumb rating --- .../Controllers/Slots/ReviewController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs index cfb9fc62..ed219045 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs @@ -112,7 +112,7 @@ public class ReviewController : ControllerBase }; this.database.Reviews.Add(review); } - review.Thumb = newReview.Thumb; + review.Thumb = Math.Clamp(newReview.Thumb, -1, 1); review.LabelCollection = LabelHelper.RemoveInvalidLabels(newReview.LabelCollection); review.Text = newReview.Text; @@ -133,7 +133,7 @@ public class ReviewController : ControllerBase this.database.RatedLevels.Add(ratedLevel); } - ratedLevel.Rating = newReview.Thumb; + ratedLevel.Rating = Math.Clamp(newReview.Thumb, -1, 1); await this.database.SaveChangesAsync();