Merge pull request #1171 from wucm667/fix/quota-display-stale-after-reset

fix: quota display shows stale cumulative usage after daily/weekly reset
This commit is contained in:
Wesley Liddick
2026-03-20 13:54:18 +08:00
committed by GitHub
2 changed files with 24 additions and 0 deletions

View File

@@ -276,11 +276,17 @@ func AccountFromServiceShallow(a *service.Account) *Account {
if limit := a.GetQuotaDailyLimit(); limit > 0 {
out.QuotaDailyLimit = &limit
used := a.GetQuotaDailyUsed()
if a.IsDailyQuotaPeriodExpired() {
used = 0
}
out.QuotaDailyUsed = &used
}
if limit := a.GetQuotaWeeklyLimit(); limit > 0 {
out.QuotaWeeklyLimit = &limit
used := a.GetQuotaWeeklyUsed()
if a.IsWeeklyQuotaPeriodExpired() {
used = 0
}
out.QuotaWeeklyUsed = &used
}
// 固定时间重置配置