fix: show membership date for stores without pickups

Treat Foodsharing's zero lastFetch value as no pickup, store memberSince, and
show compact, visible mobile status information without hover tooltips.
This commit is contained in:
2026-08-05 20:22:18 +02:00
parent a64bfe2d3f
commit 61c2488a1e
8 changed files with 121 additions and 35 deletions

View File

@@ -25,16 +25,23 @@ function getStaleLastPickupStoreIds(config = [], now = Date.now()) {
function parseLastFetchTimestamp(value) {
if (typeof value === 'string') {
return parseTimestamp(value);
if (value.trim() !== '' && Number.isFinite(Number(value))) {
return parseLastFetchTimestamp(Number(value));
}
const timestamp = parseTimestamp(value);
return timestamp && timestamp > 0 ? timestamp : null;
}
if (!Number.isFinite(Number(value))) {
return null;
}
const numericValue = Number(value);
if (numericValue <= 0) {
return null;
}
return numericValue > 1e12 ? numericValue : numericValue * 1000;
}
function updateLastPickupInfo(entry, lastFetchValue, checkedAt = new Date()) {
function updateLastPickupInfo(entry, lastFetchValue, memberSinceValue, checkedAt = new Date()) {
if (!entry || typeof entry !== 'object') {
return false;
}
@@ -51,6 +58,17 @@ function updateLastPickupInfo(entry, lastFetchValue, checkedAt = new Date()) {
entry.lastPickupAt = lastPickupAt;
changed = true;
}
} else if (entry.lastPickupAt) {
delete entry.lastPickupAt;
changed = true;
}
const memberSinceTimestamp = parseTimestamp(memberSinceValue);
if (memberSinceTimestamp !== null && memberSinceTimestamp > 0) {
const memberSinceAt = new Date(memberSinceTimestamp).toISOString();
if (entry.memberSinceAt !== memberSinceAt) {
entry.memberSinceAt = memberSinceAt;
changed = true;
}
}
return changed;
}