From b2fa1d47a8afcb64cdce95c5d25cac3ce3ed174f Mon Sep 17 00:00:00 2001 From: AJ Date: Sun, 12 Oct 2025 10:11:17 -0400 Subject: [PATCH] Add average cost per transaction to top expense categories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display the average spend per transaction for each category on the dashboard's top expense categories table. This helps users understand spending patterns beyond just total amounts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- MoneyMap/Pages/Index.cshtml | 2 ++ MoneyMap/Pages/Index.cshtml.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MoneyMap/Pages/Index.cshtml b/MoneyMap/Pages/Index.cshtml index dd38a2c..e8c9a87 100644 --- a/MoneyMap/Pages/Index.cshtml +++ b/MoneyMap/Pages/Index.cshtml @@ -71,6 +71,7 @@ Category Total Spend + Avg Per Txn % of Total Txns @@ -85,6 +86,7 @@ @c.TotalSpend.ToString("C") + @c.AveragePerTransaction.ToString("C") @c.PercentageOfTotal.ToString("F1")% diff --git a/MoneyMap/Pages/Index.cshtml.cs b/MoneyMap/Pages/Index.cshtml.cs index b124efb..cb162fa 100644 --- a/MoneyMap/Pages/Index.cshtml.cs +++ b/MoneyMap/Pages/Index.cshtml.cs @@ -45,6 +45,7 @@ namespace MoneyMap.Pages public decimal TotalSpend { get; set; } public int Count { get; set; } public decimal PercentageOfTotal { get; set; } + public decimal AveragePerTransaction { get; set; } } public class RecentTxnRow @@ -194,7 +195,8 @@ namespace MoneyMap.Pages Category = g.Key, TotalSpend = g.Sum(x => -x.Amount), Count = g.Count(), - PercentageOfTotal = totalSpend > 0 ? (g.Sum(x => -x.Amount) / totalSpend) * 100 : 0 + PercentageOfTotal = totalSpend > 0 ? (g.Sum(x => -x.Amount) / totalSpend) * 100 : 0, + AveragePerTransaction = g.Count() > 0 ? g.Sum(x => -x.Amount) / g.Count() : 0 }) .OrderByDescending(x => x.TotalSpend) .Take(count)