From 60ca9c11598f7cec761ba321043318b3206e4584 Mon Sep 17 00:00:00 2001 From: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:57:48 +0200 Subject: [PATCH] bugfix: fixed for old periods to not reduce points and scored on stale (#202) @race-of-sloths --- shared/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 7a37edf..4cf1e96 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -185,8 +185,10 @@ impl VersionedUserPeriodData { pub fn remove_reward_for_scoring(&mut self) { let mut data: UserPeriodDataV2 = self.clone().into(); - data.prs_scored -= 1; - data.total_rating -= 25; + if data.prs_scored > 0 { + data.prs_scored -= 1; + data.total_rating -= 25; + } *self = Self::V2(data); }