🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Fix status table expiry-day inconsistency; archive endpoint 500 on empty body
Omega (QA)b5286f4b7678
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 88f2a91..469a21b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -166,6 +166,8 @@- _Files: `frontend/status.html`_- **Edit-modal tabs discoverable on phones:** On a 390px viewport the Warranty/Documents/Tags tab buttons were clipped off the edge of the edit modal with no indication more tabs existed. The tab bar is swipeable, and below 480px its right edge now fades out to hint there's more to swipe to.- _Files: `frontend/style.css`_+- **Status table expiry-day consistency:** The dashboard cards and backend statistics correctly treat a warranty expiring *today* as still valid, but the status table's row label, status filter, and sort priority still used `<= today`, marking today-expiring warranties "Expired" (and the "expiring" filter excluded them, so they fell in a gap). All three now use `< today` for expired / `>= today` for expiring, matching the statistics. Also fixed `PATCH /api/warranties/<id>/archive` returning HTTP 500 on an empty JSON body — it now returns 400 with a clear message.+ - _Files: `frontend/status.js`, `backend/warranties_routes.py`_## 1.0.2 - 2025-10-30diff --git a/backend/warranties_routes.py b/backend/warranties_routes.pyindex c6c4c3f..e1cd6bb 100644--- a/backend/warranties_routes.py+++ b/backend/warranties_routes.py@@ -536,7 +536,10 @@ def toggle_archive_warranty(warranty_id):if not request.is_json:return jsonify({"error": "Request must be JSON"}), 400- archived_flag = request.json.get('archived')+ data = request.get_json(silent=True)+ if not data:+ return jsonify({"error": "Request body must be valid JSON"}), 400+ archived_flag = data.get('archived')if archived_flag is None:return jsonify({"error": "Missing 'archived' boolean in request body"}), 400diff --git a/frontend/status.js b/frontend/status.jsindex 506bc6e..869a036 100644--- a/frontend/status.js+++ b/frontend/status.js@@ -599,7 +599,7 @@}const expirationDate = new Date(warranty.expiration_date);expirationDate.setHours(0,0,0,0);- if (expirationDate <= todayForStatus) {+ if (expirationDate < todayForStatus) {return { text: i18next.t('warranties.expired'), className: 'status-expired' };}const timeDiff = expirationDate - todayForStatus;@@ -645,13 +645,13 @@expirationDate.setHours(0,0,0,0); // Normalize for comparisonif (currentStatusValue === 'all') return true;- if (currentStatusValue === 'expired') return expirationDate <= today;+ if (currentStatusValue === 'expired') return expirationDate < today;const timeDiff = expirationDate - today;const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));- if (currentStatusValue === 'expiring') return expirationDate > today && daysDiff <= EXPIRING_SOON_DAYS;- if (currentStatusValue === 'active') return expirationDate > today && daysDiff > EXPIRING_SOON_DAYS;+ if (currentStatusValue === 'expiring') return expirationDate >= today && daysDiff <= EXPIRING_SOON_DAYS;+ if (currentStatusValue === 'active') return expirationDate >= today && daysDiff > EXPIRING_SOON_DAYS;return true; // Should ideally not be reached if statusValue is one of the handled ones});@@ -815,7 +815,7 @@todayNormalized.setHours(0,0,0,0);if (isNaN(expirationDate.getTime())) return 4;- if (expirationDate <= todayNormalized) return 3;+ if (expirationDate < todayNormalized) return 3;const timeDiff = expirationDate - todayNormalized;const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));if (daysDiff <= EXPIRING_SOON_DAYS) return 2;