fix(dailies): a built-in on another server's clock leaves the header countdown alone
Beyond the Rails rolls on Asia's reset, and the header took the soonest reset of every chip, so a Europe NTE reader read "next reset in 1h" at 20:00 UTC when their day rolls in seven. The countdown now counts the reader's own clocks. Found in the whole-branch review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4427f6c2e5
commit
5080397999
2 files changed
+22
-2
No files matched your search
@@ -502,8 +502,12 @@ export function Dailies({
|
||||
|
||||
// With mixed reset clocks there is no single "resets in", so the header
|
||||
// reports the next one to land and says that it is the next one.
|
||||
const soonest = Math.min(...items.map((i) => i.resetsIn));
|
||||
const mixed = new Set(items.map((i) => i.resetsIn)).size > 1;
|
||||
// A built-in on another server's clock (`clock`) rolls a cycle, not the
|
||||
// reader's day: counting it would announce a reset nothing daily follows.
|
||||
const own = items.filter((i) => i.clock === undefined);
|
||||
const clocks = own.length > 0 ? own : items;
|
||||
const soonest = Math.min(...clocks.map((i) => i.resetsIn));
|
||||
const mixed = new Set(clocks.map((i) => i.resetsIn)).size > 1;
|
||||
const open = items.find((i) => i.key === editing && i.goal?.measure === "amount");
|
||||
|
||||
const { today, longer } = splitByCadence(items);
|
||||
|
||||
@@ -1471,6 +1471,22 @@ describe("weekly and monthly tasks in the dailies strip", () => {
|
||||
expect(item!.resetsIn).toBeGreaterThan(chore!.resetsIn);
|
||||
});
|
||||
|
||||
test("a clocked built-in does not move the header's reset countdown", () => {
|
||||
const rails = {
|
||||
id: "routine:nte:test-rails", game: "nte", title: "Beyond the Rails",
|
||||
period: { unit: "cycle" as const, days: 14, from: "2026-10-22" },
|
||||
measure: { kind: "days" as const, required: 1 }, clock: "asia" as const,
|
||||
};
|
||||
// 20:00 UTC: Europe's NTE day rolls at 03:00 UTC, seven hours off; Asia's in one.
|
||||
const html = render(
|
||||
<Dailies games={["nte"]} events={[]} region="europe" now={Date.parse("2026-10-21T20:00:00Z")}
|
||||
showChores daysFor={() => []} onToggleDay={() => {}} tasks={[rails]}
|
||||
taskStatusFor={() => undefined} />,
|
||||
);
|
||||
expect(html).not.toContain("next reset in");
|
||||
expect(html).toMatch(/resets in (<!-- -->)?7h/);
|
||||
});
|
||||
|
||||
test("a cycle chip shows its days left, under a heading that names it", () => {
|
||||
const html = render(
|
||||
<Dailies games={["zzz"]} events={[]} region="europe" now={NOW} showChores={false}
|
||||
|
||||
Reference in new issue
Block a user