fix(sleep): one day total for every sleep reader, and the latest night is a night

A day's sleep is the main night plus its naps (daySleepMinutes). The
series, the sleep score and the composition already read it that way; the
sleep list, the CSV export and the correlation sleep channel read the main
night alone, so a day of naps listed as 0 h and an average over the list
counted it as a night without sleep. The list now carries the day total in
value and the main night alone in the new mainAsleepMinutes field; the nap
caption reads as included.

GET /api/sleep/night without a date answered the latest day holding any
sleep, so a nap after the last night left the hypnogram with no night to
draw. It now walks back to the latest night with a main sleep; nap days
stay reachable by date.

The SQL night page bounded a night by its asleep sessions only, so an
in-bed-only session of the same night fell outside a chunked read that the
one-night read counted. The span now covers every session of the night.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 09:28:40 +02:00
1 parent 3004f55875
commit 63bbf0931c
20 files changed
+339 -94

No files matched your search

+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Nächste Seite",
"dailyTotalCaption": "({count} Einzelwerte)",
"openMetricInsights": "{type}-Auswertung öffnen",
"sleepNapCaption": "+{count} Nickerchen",
"sleepNapCaption": "inkl. {count} Nickerchen",
"sleepAwakeningsCaption": "{count} Wachphasen",
"expandDay": "Einzelwerte dieses Tages anzeigen",
"collapseDay": "Einzelwerte dieses Tages ausblenden",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Next page",
"dailyTotalCaption": "({count} samples)",
"openMetricInsights": "Open {type} insights",
"sleepNapCaption": "+{count} nap(s)",
"sleepNapCaption": "incl. {count} nap(s)",
"sleepAwakeningsCaption": "{count} awakening(s)",
"expandDay": "Show samples for this day",
"collapseDay": "Hide samples for this day",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Página siguiente",
"dailyTotalCaption": "({count} muestras)",
"openMetricInsights": "Abrir análisis de {type}",
"sleepNapCaption": "+{count} siesta(s)",
"sleepNapCaption": "incl. {count} siesta(s)",
"sleepAwakeningsCaption": "{count} despertar(es)",
"expandDay": "Mostrar las muestras de este día",
"collapseDay": "Ocultar las muestras de este día",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Page suivante",
"dailyTotalCaption": "({count} échantillons)",
"openMetricInsights": "Ouvrir l'analyse {type}",
"sleepNapCaption": "+{count} sieste(s)",
"sleepNapCaption": "dont {count} sieste(s)",
"sleepAwakeningsCaption": "{count} réveil(s)",
"expandDay": "Afficher les échantillons de ce jour",
"collapseDay": "Masquer les échantillons de ce jour",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Pagina successiva",
"dailyTotalCaption": "({count} campioni)",
"openMetricInsights": "Apri l'analisi {type}",
"sleepNapCaption": "+{count} pisolino/i",
"sleepNapCaption": "incl. {count} pisolino/i",
"sleepAwakeningsCaption": "{count} risveglio/i",
"expandDay": "Mostra i campioni di questa giornata",
"collapseDay": "Nascondi i campioni di questa giornata",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "다음 쪽",
"dailyTotalCaption": "({count}개 샘플)",
"openMetricInsights": "{type} 인사이트 열기",
"sleepNapCaption": "+낮잠 {count}회",
"sleepNapCaption": "낮잠 {count}회 포함",
"sleepAwakeningsCaption": "깬 횟수 {count}회",
"expandDay": "이 날의 샘플 보기",
"collapseDay": "이 날의 샘플 숨기기",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Volgende pagina",
"dailyTotalCaption": "({count} metingen)",
"openMetricInsights": "Inzichten voor {type} openen",
"sleepNapCaption": "+{count} dutje(s)",
"sleepNapCaption": "incl. {count} dutje(s)",
"sleepAwakeningsCaption": "{count} keer wakker",
"expandDay": "Metingen van deze dag tonen",
"collapseDay": "Metingen van deze dag verbergen",
+1 -1
View File
@@ -845,7 +845,7 @@
"nextPage": "Następna strona",
"dailyTotalCaption": "({count} pomiarów)",
"openMetricInsights": "Otwórz analizę {type}",
"sleepNapCaption": "+{count} drzemka/i",
"sleepNapCaption": "w tym {count} drzemka/i",
"sleepAwakeningsCaption": "{count} przebudzenia",
"expandDay": "Pokaż pomiary z tego dnia",
"collapseDay": "Ukryj pomiary z tego dnia",