Skip to content

Commit

Permalink
fix(api) : Activity's amount round
Browse files Browse the repository at this point in the history
- Use Away from zero to round the activity's amount when the value is halfway between two others
  • Loading branch information
syukoGit committed Dec 4, 2023
1 parent d4049b6 commit 3fa4347
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -33,4 +33,4 @@ public class Activity
public required string Title { get; set; }

public required double UnitAmount { get; set; }
}
}

0 comments on commit 3fa4347

Please sign in to comment.