Skip to content

Commit

Permalink
#408 - Fix summary when only fixed expenses are present.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Aug 2, 2021
1 parent a182d1b commit 2437811
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Money.Blazor.Host/Pages/Summary.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ private void Sort()

protected string GetPercentualValue(CategoryWithAmountModel category)
{
decimal percentage = 0;
decimal total = Categories.Sum(c => c.TotalAmount.Value);
decimal percentage = 100 / total * category.TotalAmount.Value;
if (total != 0)
percentage = 100 / total * category.TotalAmount.Value;

return percentage.ToString("0.##", CultureInfo.InvariantCulture);
}
Expand Down

0 comments on commit 2437811

Please sign in to comment.