From 3fa434738e2c7bb3b271e696c0d645d6479cb6ce Mon Sep 17 00:00:00 2001 From: syukoGit Date: Mon, 4 Dec 2023 11:09:30 +0100 Subject: [PATCH] fix(api) : Activity's amount round - Use Away from zero to round the activity's amount when the value is halfway between two others --- .../Server/Entities/FirefighterActivities/Activity.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FirefighterStats/Server/Entities/FirefighterActivities/Activity.cs b/FirefighterStats/Server/Entities/FirefighterActivities/Activity.cs index 512f084..493fc07 100644 --- a/FirefighterStats/Server/Entities/FirefighterActivities/Activity.cs +++ b/FirefighterStats/Server/Entities/FirefighterActivities/Activity.cs @@ -13,7 +13,7 @@ namespace FirefighterStats.Server.Entities.FirefighterActivities; [UsedImplicitly] public class Activity { - public double Amount => Math.Round(DurationInHours * Rate * UnitAmount, 2); + public double Amount => Math.Round(DurationInHours * Rate * UnitAmount, 2, MidpointRounding.AwayFromZero); public double DurationInHours => (EndDateTime - StartDateTime).TotalHours; @@ -33,4 +33,4 @@ public class Activity public required string Title { get; set; } public required double UnitAmount { get; set; } -} \ No newline at end of file +}