Skip to content

Commit

Permalink
#377 - Category with only fixed expenses in summary period is shown w…
Browse files Browse the repository at this point in the history
…ith zero price.
  • Loading branch information
maraf committed Jun 16, 2021
1 parent 99a405a commit e16093a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Money.Models.Builders/OutcomeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,17 @@ private async Task<List<CategoryWithAmountModel>> GetCategoryWithAmounts(ReadMod
{
Price price;
if (totals.TryGetValue(category.CategoryId, out price))
price = price + priceConverter.ToDefault(userKey, outcome);
{
if (!outcome.IsFixed)
price = price + priceConverter.ToDefault(userKey, outcome);
}
else
price = priceConverter.ToDefault(userKey, outcome);
{
if (!outcome.IsFixed)
price = priceConverter.ToDefault(userKey, outcome);
else
price = priceConverter.ZeroDefault(userKey);
}

totals[category.CategoryId] = price;
}
Expand Down Expand Up @@ -129,7 +137,6 @@ public async Task<List<CategoryWithAmountModel>> HandleAsync(ListMonthCategoryWi
List<OutcomeEntity> outcomes = await db.Outcomes
.WhereUserKey(query.UserKey)
.Where(o => o.When.Month == query.Month.Month && o.When.Year == query.Month.Year)
.Where(o => o.IsFixed == false)
.Include(o => o.Categories)
.ToListAsync();

Expand All @@ -144,7 +151,6 @@ public async Task<List<CategoryWithAmountModel>> HandleAsync(ListYearCategoryWit
List<OutcomeEntity> outcomes = await db.Outcomes
.WhereUserKey(query.UserKey)
.Where(o => o.When.Year == query.Year.Year)
.Where(o => o.IsFixed == false)
.Include(o => o.Categories)
.ToListAsync();

Expand Down

0 comments on commit e16093a

Please sign in to comment.