WIP
This commit is contained in:
1 parent
38067df8c3
commit
492d86db9e
30 files changed
+2473
-40
No files matched your search
@@ -24,12 +24,13 @@ public class DashboardService(TransactionService transactionService, AccountServ
|
||||
var allTransactions = await _transactionService.GetTransactionsInRangeAsync(userId, fetchStart, fetchEnd);
|
||||
|
||||
var recent = allTransactions
|
||||
.Where(t => t.Date.Date >= windowStart.Date && t.Date.Date <= DateTime.Today)
|
||||
.Where(t => (t.Date.Date >= windowStart.Date && t.Date.Date <= DateTime.Today)
|
||||
|| (t.IsPaid && t.Date.Date > DateTime.Today && t.Date.Date <= windowEnd.Date))
|
||||
.OrderByDescending(t => t.Date)
|
||||
.ToList();
|
||||
|
||||
var upcoming = allTransactions
|
||||
.Where(t => t.Date.Date > DateTime.Today && t.Date.Date <= windowEnd.Date)
|
||||
.Where(t => t.Date.Date > DateTime.Today && t.Date.Date <= windowEnd.Date && !t.IsPaid)
|
||||
.OrderBy(t => t.Date)
|
||||
.ToList();
|
||||
|
||||
@@ -57,8 +58,9 @@ public class DashboardService(TransactionService transactionService, AccountServ
|
||||
{
|
||||
labels.Add(d.ToString("MMM dd"));
|
||||
|
||||
// Paid future transactions are excluded — their effect is already in CurrentBalance
|
||||
var dayTxns = transactions
|
||||
.Where(t => t.Date.Date == d.Date)
|
||||
.Where(t => t.Date.Date == d.Date && !(t.IsPaid && t.Date.Date > today))
|
||||
.Select(t => $"{(t.Type == TransactionType.Income ? "+" : "-")}{t.Account.FormatAmount(t.Amount)} {t.Description} ({t.Account.Name})")
|
||||
.ToList();
|
||||
dayTransactionLabels.Add(dayTxns);
|
||||
@@ -85,8 +87,9 @@ public class DashboardService(TransactionService transactionService, AccountServ
|
||||
}
|
||||
else
|
||||
{
|
||||
// Future-only window: project forward from CurrentBalance using only unpaid transactions
|
||||
foreach (var t in accountTransactions
|
||||
.Where(t => t.Date.Date > today && t.Date.Date < startDate.Date)
|
||||
.Where(t => t.Date.Date > today && t.Date.Date < startDate.Date && !t.IsPaid)
|
||||
.OrderBy(t => t.Date))
|
||||
{
|
||||
runningBalance += t.Type == TransactionType.Income ? t.Amount : -t.Amount;
|
||||
@@ -95,7 +98,7 @@ public class DashboardService(TransactionService transactionService, AccountServ
|
||||
|
||||
for (var d = startDate; d <= endDate; d = d.AddDays(1))
|
||||
{
|
||||
var dayTxns = accountTransactions.Where(t => t.Date.Date == d.Date);
|
||||
var dayTxns = accountTransactions.Where(t => t.Date.Date == d.Date && !(t.IsPaid && t.Date.Date > today));
|
||||
foreach (var t in dayTxns)
|
||||
{
|
||||
runningBalance += t.Type == TransactionType.Income ? t.Amount : -t.Amount;
|
||||
|
||||
Reference in new issue
Block a user