diff --git a/src/client/components/Colophon.tsx b/src/client/components/Colophon.tsx index 0e31dc2..f1dc0d1 100644 --- a/src/client/components/Colophon.tsx +++ b/src/client/components/Colophon.tsx @@ -298,8 +298,17 @@ export function Colophon({ {shownStale.flatMap((g) => g.sources.map((src) => { const site = siteFor(src.url); - const confirmed = src.lastConfirmedAt - ? `${formatRemaining(now - Date.parse(src.lastConfirmedAt))} ago` + const pullDate = + src.lastConfirmedAt !== null && + src.contentChangedAt !== null && + Date.parse(src.lastConfirmedAt) >= Date.parse(src.contentChangedAt) + ? src.lastConfirmedAt + : (src.lastConfirmedAt ?? + (src.contentChangedAt && now - Date.parse(src.contentChangedAt) <= STALE_AFTER_MS + ? src.contentChangedAt + : null)); + const confirmed = pullDate + ? `${formatRemaining(now - Date.parse(pullDate))} ago` : "never"; const updated = src.contentChangedAt ? `${formatRemaining(now - Date.parse(src.contentChangedAt))} ago` @@ -307,8 +316,8 @@ export function Colophon({ ? `${formatRemaining(now - Date.parse(src.lastSuccessAt))} ago` : "never"; const isPullRecent = - src.lastConfirmedAt !== null && - now - Date.parse(src.lastConfirmedAt) <= STALE_AFTER_MS; + pullDate !== null && + now - Date.parse(pullDate) <= STALE_AFTER_MS; const isContentStale = src.contentChangedAt === null || now - Date.parse(src.contentChangedAt) > STALE_AFTER_MS; diff --git a/test/custom-ui.test.tsx b/test/custom-ui.test.tsx index 875dc04..4a4ad99 100644 --- a/test/custom-ui.test.tsx +++ b/test/custom-ui.test.tsx @@ -304,6 +304,44 @@ describe("Colophon freshness notice (PRD F7)", () => { expect(html).toContain("site has no new updates"); }); + test("source breakdown does not report recent content updates as pulled never or overdue", () => { + const PULL_TIME = new Date(NOW - 11 * HOUR).toISOString(); + const OLD_SITE = new Date(NOW - 57 * HOUR).toISOString(); + const RECENT_CONTENT = new Date(NOW - 1 * HOUR).toISOString(); + const html = renderToStaticMarkup( + , + ); + expect(html).toContain("Arknights: Endfield"); + expect(html).toContain("data pulled 11h 0m ago, site updated 2d 9h ago"); + expect(html).toContain("Game8"); + expect(html).toContain("pulled 1h 0m ago, site updated 1h 0m ago (up to date)"); + expect(html).not.toContain("pulled never"); + expect(html).not.toContain("pull overdue"); + }); + test("summarises instead of listing when every game is behind", () => { // What a refresh that stopped running looks like. Ten names each repeating // the same age is less readable than the count this replaced.