FIx
This commit is contained in:
1 parent
b6b794f0b4
commit
75d804b7ff
5 files changed
+14
-13
No files matched your search
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
using BudgetApp.Data.Entities;
|
using BudgetApp.Data.Entities;
|
||||||
|
|
||||||
namespace BudgetApp.Components.Pages;
|
namespace BudgetApp.Components.Pages;
|
||||||
@@ -133,4 +132,5 @@ public partial class Accounts
|
|||||||
[System.ComponentModel.DataAnnotations.MaxLength(3)]
|
[System.ComponentModel.DataAnnotations.MaxLength(3)]
|
||||||
public string CurrencyCode { get; set; } = "GBP";
|
public string CurrencyCode { get; set; } = "GBP";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -76,22 +76,16 @@ public class DashboardService(ITransactionRepository transactionRepository, IAcc
|
|||||||
|
|
||||||
if (startDate.Date <= today)
|
if (startDate.Date <= today)
|
||||||
{
|
{
|
||||||
foreach (var t in accountTransactions
|
runningBalance = accountTransactions.Where(t => t.Date.Date >= startDate.Date && t.Date.Date <= today)
|
||||||
.Where(t => t.Date.Date >= startDate.Date && t.Date.Date <= today)
|
.OrderByDescending(t => t.Date)
|
||||||
.OrderByDescending(t => t.Date))
|
.Aggregate(runningBalance, (current, t) => current - (t.Type == TransactionType.Income ? t.Amount : -t.Amount));
|
||||||
{
|
|
||||||
runningBalance -= t.Type == TransactionType.Income ? t.Amount : -t.Amount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Future-only window: project forward from CurrentBalance using only unpaid transactions
|
// Future-only window: project forward from CurrentBalance using only unpaid transactions
|
||||||
foreach (var t in accountTransactions
|
runningBalance += accountTransactions.Where(t => t.Date.Date > today && t.Date.Date < startDate.Date && !t.IsPaid)
|
||||||
.Where(t => t.Date.Date > today && t.Date.Date < startDate.Date && !t.IsPaid)
|
.OrderBy(t => t.Date)
|
||||||
.OrderBy(t => t.Date))
|
.Sum(t => t.Type == TransactionType.Income ? t.Amount : -t.Amount);
|
||||||
{
|
|
||||||
runningBalance += t.Type == TransactionType.Income ? t.Amount : -t.Amount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var d = startDate; d <= endDate; d = d.AddDays(1))
|
for (var d = startDate; d <= endDate; d = d.AddDays(1))
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -5,9 +5,16 @@ EXPOSE 8080
|
|||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copy project files first so the restore layer is cached independently of source changes
|
||||||
|
COPY BudgetApp.Data/BudgetApp.Data.csproj BudgetApp.Data/
|
||||||
COPY BudgetApp/BudgetApp.csproj BudgetApp/
|
COPY BudgetApp/BudgetApp.csproj BudgetApp/
|
||||||
RUN dotnet restore BudgetApp/BudgetApp.csproj
|
RUN dotnet restore BudgetApp/BudgetApp.csproj
|
||||||
|
|
||||||
|
# Copy all source (BudgetApp.Data must be present before building BudgetApp)
|
||||||
|
COPY BudgetApp.Data/ BudgetApp.Data/
|
||||||
COPY BudgetApp/ BudgetApp/
|
COPY BudgetApp/ BudgetApp/
|
||||||
|
|
||||||
WORKDIR /src/BudgetApp
|
WORKDIR /src/BudgetApp
|
||||||
RUN dotnet publish -c Release -o /app/publish
|
RUN dotnet publish -c Release -o /app/publish
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user