fix: KoePi Tage-Countdown entfernt, nur noch echtes Start-/Enddatum verwendet
This commit is contained in:
@@ -391,7 +391,7 @@ function publishKoepiState({ offers, changed }) {
|
|||||||
|
|
||||||
// Lesbarer Mehrzeiler fürs Dashboard, zusätzlich zur strukturierten Liste
|
// Lesbarer Mehrzeiler fürs Dashboard, zusätzlich zur strukturierten Liste
|
||||||
const listeText = list.length
|
const listeText = list.length
|
||||||
? list.map(o => `${o.retailer}: ${o.price}${o.validity || o.dateRange ? ' (' + (o.validity || o.dateRange) + ')' : ''}`).join('\n')
|
? list.map(o => `${o.retailer}: ${o.price}${o.dateRange ? ' (' + o.dateRange + ')' : ''}`).join('\n')
|
||||||
: 'keine Angebote';
|
: 'keine Angebote';
|
||||||
|
|
||||||
client.publish(`${BASE_TOPIC}/koepi/state`, state, { retain: true });
|
client.publish(`${BASE_TOPIC}/koepi/state`, state, { retain: true });
|
||||||
|
|||||||
@@ -263,10 +263,14 @@ router.get('/img', authenticate, (req, res) => {
|
|||||||
// ── Tages-Cron: neue/geänderte Angebote per Pushover melden ─────────────────
|
// ── Tages-Cron: neue/geänderte Angebote per Pushover melden ─────────────────
|
||||||
const KOEPI_SETTINGS_KEY = 'koepi_last_offers';
|
const KOEPI_SETTINGS_KEY = 'koepi_last_offers';
|
||||||
|
|
||||||
// Vergleichbare, stabile Signatur eines Angebots (Reihenfolge-unabhängig)
|
// Vergleichbare, stabile Signatur eines Angebots (Reihenfolge-unabhängig).
|
||||||
|
// Bewusst NUR dateRange (echtes Datum), NICHT validity ("Noch X Tage") — der
|
||||||
|
// Countdown-Text ändert sich täglich von allein und würde sonst jeden Tag
|
||||||
|
// eine Pushover-Benachrichtigung auslösen, auch wenn sich am Angebot nichts
|
||||||
|
// geändert hat.
|
||||||
function offerSignature(offers) {
|
function offerSignature(offers) {
|
||||||
return offers
|
return offers
|
||||||
.map(o => `${(o.retailer || '').toLowerCase().trim()}|${(o.price || '').trim()}|${(o.validity || o.dateRange || '').trim()}`)
|
.map(o => `${(o.retailer || '').toLowerCase().trim()}|${(o.price || '').trim()}|${(o.dateRange || '').trim()}`)
|
||||||
.sort()
|
.sort()
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
@@ -274,7 +278,7 @@ function offerSignature(offers) {
|
|||||||
function formatOfferMessage(offers) {
|
function formatOfferMessage(offers) {
|
||||||
if (!offers.length) return 'Aktuell keine König Pilsener Angebote gefunden.';
|
if (!offers.length) return 'Aktuell keine König Pilsener Angebote gefunden.';
|
||||||
return offers
|
return offers
|
||||||
.map(o => `${o.retailer || '?'}: ${o.price || '?'} (${o.validity || o.dateRange || 'Gültigkeit unbekannt'})`)
|
.map(o => `${o.retailer || '?'}: ${o.price || '?'} (${o.dateRange || 'Gültigkeit unbekannt'})`)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ function OfferCard({ offer }) {
|
|||||||
|
|
||||||
{/* Gültigkeit */}
|
{/* Gültigkeit */}
|
||||||
<div style={{ borderTop:'1px solid rgba(255,255,255,0.06)', paddingTop:6, display:'flex', gap:12, flexWrap:'wrap' }}>
|
<div style={{ borderTop:'1px solid rgba(255,255,255,0.06)', paddingTop:6, display:'flex', gap:12, flexWrap:'wrap' }}>
|
||||||
{offer.validity && (
|
|
||||||
<span style={{ color:'#f59e0b', fontFamily:'monospace', fontSize:10 }}>⏰ {offer.validity}</span>
|
|
||||||
)}
|
|
||||||
{offer.dateRange && (
|
{offer.dateRange && (
|
||||||
<span style={{ color:'rgba(255,255,255,0.35)', fontFamily:'monospace', fontSize:10 }}>📅 {offer.dateRange}</span>
|
<span style={{ color:'rgba(255,255,255,0.35)', fontFamily:'monospace', fontSize:10 }}>📅 {offer.dateRange}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user