forked from penguin86/luna-tracker
Add cross-device timer sync via WebDAV
When a sleep or breastfeeding timer is started, an "ongoing" event is immediately saved to the logbook and synced via WebDAV. Other devices detect this event on sync and can display/stop the timer. This allows partners to stop timers started on another device. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,14 +79,14 @@ class StatisticsCalculator(private val events: List<LunaEvent>) {
|
||||
}
|
||||
|
||||
private fun getEventsInRange(startUnix: Long, endUnix: Long): List<LunaEvent> {
|
||||
return events.filter { it.time >= startUnix && it.time < endUnix }
|
||||
return events.filter { it.time >= startUnix && it.time < endUnix && !it.ongoing }
|
||||
}
|
||||
|
||||
private fun getEventsForDays(days: Int): List<LunaEvent> {
|
||||
val now = System.currentTimeMillis() / 1000
|
||||
val startOfToday = getStartOfDay(now)
|
||||
val startTime = startOfToday - (days - 1) * 24 * 60 * 60
|
||||
return events.filter { it.time >= startTime }
|
||||
return events.filter { it.time >= startTime && !it.ongoing }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user