fix: keep weekly summary on codex limit
Frontend / quality (push) Canceled after 0s

This commit is contained in:
2026-09-02 16:30:05 +08:00
parent 75fba7ab69
commit 0b2f969c6d
3 changed files with 29 additions and 15 deletions
+10 -5
View File
@@ -1701,11 +1701,16 @@ const quickSummaryLimits = (
(limit) =>
limit.windowDurationMinutes > 0 && limit.windowDurationMinutes < 24 * 60,
);
const week = sorted.find(
(limit) =>
limit.windowDurationMinutes >= 6 * 24 * 60 &&
limit.windowDurationMinutes <= 8 * 24 * 60,
);
const week =
sorted.find(
(limit) =>
limit.limitId.toLowerCase() === "codex" &&
limit.windowDurationMinutes === 168 * 60,
) ??
sorted.find(
(limit) =>
limit.limitName == null && limit.windowDurationMinutes === 168 * 60,
);
const selected: Array<{ kind: QuickLimitKind; limit: Limit }> = [];
if (hour) selected.push({ kind: "hour", limit: hour });
if (week && week !== hour) selected.push({ kind: "week", limit: week });
+18 -9
View File
@@ -83,6 +83,14 @@ test("shows every account as a collapsible summary on the overview", async ({
connected: true,
},
limits: [
{
limitId: "base_model_inference",
limitName: "gpt-reserve",
windowType: "primary",
usedPercent: 0,
windowDurationMinutes: 10_080,
resetsAt: 1_900_700_000,
},
{
limitId: "primary",
limitName: "5 小时限额",
@@ -92,9 +100,9 @@ test("shows every account as a collapsible summary on the overview", async ({
resetsAt: 1_900_000_000,
},
{
limitId: "secondary",
limitName: "周限额",
windowType: "weekly",
limitId: "codex",
limitName: null,
windowType: "secondary",
usedPercent: 20,
windowDurationMinutes: 10_080,
resetsAt: 1_900_604_800,
@@ -132,9 +140,9 @@ test("shows every account as a collapsible summary on the overview", async ({
},
limits: [
{
limitId: "secondary",
limitName: "周限额",
windowType: "weekly",
limitId: "codex",
limitName: null,
windowType: "secondary",
usedPercent: 40,
windowDurationMinutes: 10_080,
resetsAt: 1_900_604_800,
@@ -186,9 +194,10 @@ test("shows every account as a collapsible summary on the overview", async ({
await expect(firstSummary.locator('[data-window-kind="hour"]')).toContainText(
"5 小时额度65%剩余",
);
await expect(firstSummary.locator('[data-window-kind="week"]')).toContainText(
"周额度80%剩余",
);
const weeklySummary = firstSummary.locator('[data-window-kind="week"]');
await expect(weeklySummary).toContainText("周额度80%剩余");
await expect(weeklySummary).not.toContainText("100%剩余");
await expect(weeklySummary).toHaveAttribute("aria-label", /周额度,剩余 80%/);
await expect(
firstSummary.locator(".account-summary-limit-reset"),
).toHaveCount(2);