fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 37s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s

This commit is contained in:
2026-01-02 18:51:28 +08:00
parent e250a7df2f
commit 5c76e9287e
9 changed files with 60 additions and 66 deletions

View File

@@ -661,6 +661,15 @@ public class TransactionRecordRepository(IFreeSql freeSql) : BaseRepository<Tran
var minAmount = absAmount - 5;
var maxAmount = absAmount + 5;
var currentRecord = await FreeSql.Select<TransactionRecord>()
.Where(t => t.Id == currentId)
.FirstAsync();
if (currentRecord == null)
{
return new List<TransactionRecord>();
}
var list = await FreeSql.Select<TransactionRecord>()
.Where(t => t.Id != currentId)
.Where(t => t.Type != currentType)
@@ -668,7 +677,9 @@ public class TransactionRecordRepository(IFreeSql freeSql) : BaseRepository<Tran
.Take(50)
.ToListAsync();
return list.OrderBy(t => Math.Abs(Math.Abs(t.Amount) - absAmount)).ToList();
return list.OrderBy(t => Math.Abs(Math.Abs(t.Amount) - absAmount))
.ThenBy(x=> Math.Abs((x.OccurredAt - currentRecord.OccurredAt).TotalSeconds))
.ToList();
}
public async Task<int> UpdateCategoryNameAsync(string oldName, string newName, TransactionType type)