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:
@@ -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
|
||||
show compact, visible mobile status information without hover tooltips.
|
||||
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.
|
||||
|
||||
@@ -17,6 +17,10 @@ function getStaleLastPickupStoreIds(config = [], now = Date.now()) {
|
||||
if (!entry?.id || entry.hidden) {
|
||||
return false;
|
||||
}
|
||||
const lastPickupAt = parseTimestamp(entry.lastPickupAt);
|
||||
if (entry.lastPickupAt && (!lastPickupAt || lastPickupAt <= 0)) {
|
||||
return true;
|
||||
}
|
||||
const checkedAt = parseTimestamp(entry.lastPickupCheckedAt);
|
||||
return !checkedAt || now - checkedAt > LAST_PICKUP_INFO_MAX_AGE_MS;
|
||||
})
|
||||
|
||||
@@ -12,10 +12,11 @@ describe('last pickup info', () => {
|
||||
{ id: 'missing' },
|
||||
{ id: 'stale', lastPickupCheckedAt: '2026-07-29T11:59:59.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 }
|
||||
];
|
||||
|
||||
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', () => {
|
||||
|
||||
Reference in New Issue
Block a user