1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
SunCheng
2026-01-17 15:55:46 +08:00
parent 1b3d01c78c
commit 9b25c62662
2 changed files with 14 additions and 7 deletions

View File

@@ -48,8 +48,8 @@ public class BudgetService(
if (archive != null)
{
var periodRange = GetPeriodRange(DateTime.Now, BudgetPeriodType.Month, referenceDate);
return archive.Content.Select(c => new BudgetResult
var (start, end) = GetPeriodRange(DateTime.Now, BudgetPeriodType.Month, referenceDate);
return [.. archive.Content.Select(c => new BudgetResult
{
Name = c.Name,
Type = c.Type,
@@ -60,9 +60,9 @@ public class BudgetService(
NoLimit = c.NoLimit,
IsMandatoryExpense = c.IsMandatoryExpense,
Description = c.Description,
PeriodStart = periodRange.start,
PeriodEnd = periodRange.end,
}).ToList();
PeriodStart = start,
PeriodEnd = end,
})];
}
logger.LogWarning("获取预算列表时发现归档数据缺失Year: {Year}, Month: {Month}", year, month);
@@ -87,7 +87,13 @@ public class BudgetService(
referenceDate,
budgets));
return dtos.Where(dto => dto != null).Cast<BudgetResult>().ToList();
dtos = dtos
.OrderByDescending(x => x.IsMandatoryExpense)
.ThenBy(x => x.Type)
.ThenByDescending(x => x.Current)
.ToList();
return [.. dtos.Where(dto => dto != null).Cast<BudgetResult>()];
}
public async Task<BudgetResult?> GetSavingsBudgetAsync(int year, int month, BudgetPeriodType type)
@@ -299,7 +305,7 @@ public class BudgetService(
for (int i = 1; i <= 12; i++)
{
var currentMonthDate = new DateTime(startDate.Year, i, 1);
if (currentMonthDate.Year > now.Year || (currentMonthDate.Year == now.Year && i > now.Month))
{
result.Trend.Add(null);