🐛 Fix wrong counting usage

This commit is contained in:
2025-07-29 14:43:40 +08:00
parent 28f6893c68
commit 83059374e9
3 changed files with 5 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ public class UsageService(AppDatabase db)
PoolUsages = poolUsages,
TotalUsageBytes = totalUsage,
TotalFileCount = totalFileCount,
UsedQuota = await GetTotalBillableUsage()
UsedQuota = await GetTotalBillableUsage(accountId)
};
}
@@ -98,10 +98,11 @@ public class UsageService(AppDatabase db)
};
}
public async Task<long> GetTotalBillableUsage()
public async Task<long> GetTotalBillableUsage(Guid accountId)
{
var now = SystemClock.Instance.GetCurrentInstant();
var files = await db.Files
.Where(f => f.AccountId == accountId)
.Where(f => f.PoolId.HasValue)
.Where(f => !f.IsMarkedRecycle)
.Include(f => f.Pool)