fix: refresh invalid last pickup timestamps

Force an immediate member refresh for legacy epoch timestamps so they are
replaced by the correct no-pickup status without waiting for the weekly check.
This commit is contained in:
2026-08-05 20:24:37 +02:00
parent 61c2488a1e
commit fb6bc6addd
3 changed files with 9 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
fix: show membership date for stores without pickups fix: refresh invalid last pickup timestamps
Treat Foodsharing's zero lastFetch value as no pickup, store memberSince, and Force an immediate member refresh for legacy epoch timestamps so they are
show compact, visible mobile status information without hover tooltips. replaced by the correct no-pickup status without waiting for the weekly check.

View File

@@ -17,6 +17,10 @@ function getStaleLastPickupStoreIds(config = [], now = Date.now()) {
if (!entry?.id || entry.hidden) { if (!entry?.id || entry.hidden) {
return false; return false;
} }
const lastPickupAt = parseTimestamp(entry.lastPickupAt);
if (entry.lastPickupAt && (!lastPickupAt || lastPickupAt <= 0)) {
return true;
}
const checkedAt = parseTimestamp(entry.lastPickupCheckedAt); const checkedAt = parseTimestamp(entry.lastPickupCheckedAt);
return !checkedAt || now - checkedAt > LAST_PICKUP_INFO_MAX_AGE_MS; return !checkedAt || now - checkedAt > LAST_PICKUP_INFO_MAX_AGE_MS;
}) })

View File

@@ -12,10 +12,11 @@ describe('last pickup info', () => {
{ id: 'missing' }, { id: 'missing' },
{ id: 'stale', lastPickupCheckedAt: '2026-07-29T11:59:59.000Z' }, { id: 'stale', lastPickupCheckedAt: '2026-07-29T11:59:59.000Z' },
{ id: 'fresh', lastPickupCheckedAt: '2026-07-30T12:00:01.000Z' }, { id: 'fresh', lastPickupCheckedAt: '2026-07-30T12:00:01.000Z' },
{ id: 'epoch', lastPickupAt: '1970-01-01T00:00:00.000Z', lastPickupCheckedAt: '2026-08-05T12:00:00.000Z' },
{ id: 'hidden', hidden: true } { id: 'hidden', hidden: true }
]; ];
expect(getStaleLastPickupStoreIds(config, now)).toEqual(['missing', 'stale']); expect(getStaleLastPickupStoreIds(config, now)).toEqual(['missing', 'stale', 'epoch']);
}); });
it('records a successful check independently from the pickup date', () => { it('records a successful check independently from the pickup date', () => {