feat: implement LiveTicker functionality with sound notifications and UI updates
This commit is contained in:
@@ -16,6 +16,11 @@ function score(data) {
|
||||
return `${home ?? 0}:${away ?? 0}`
|
||||
}
|
||||
|
||||
function completedTime(data, fallback) {
|
||||
const timestamp = Date.parse(data.end_date || data.entry_date || '')
|
||||
return Number.isFinite(timestamp) ? timestamp : fallback
|
||||
}
|
||||
|
||||
export async function refreshLiveTicker(now = new Date()) {
|
||||
const season = getCurrentSeasonSlug(now)
|
||||
const { data } = await readSpielplanData({ season })
|
||||
@@ -37,7 +42,7 @@ export async function refreshLiveTicker(now = new Date()) {
|
||||
const payload = await response.json()
|
||||
const report = payload?.data
|
||||
if (!report) throw new Error('Keine Spieldaten erhalten')
|
||||
const completedAt = report.is_completed ? nowMs : null
|
||||
const completedAt = report.is_completed ? completedTime(report, nowMs) : null
|
||||
const previous = cache.get(meetingId)
|
||||
cache.set(meetingId, {
|
||||
meetingId,
|
||||
|
||||
Reference in New Issue
Block a user