- Integrated date parsing improvements using dateutil for better handling of various date formats in sleep data. - Added total sleep hours to the nights dictionary for comprehensive sleep analysis. - Updated the import logic to handle cases where sleep duration is zero, providing appropriate warnings. - Enhanced the CSV import interface to detect Apple sleep CSV format and provide user feedback on template selection. - Improved the admin CSV template editor to accommodate new sleep import requirements and clarify usage instructions.
28 lines
893 B
SQL
28 lines
893 B
SQL
-- Migration 045: Schlaf-Systemvorlage — Signatur wie „Schlafanalyse“-Export (Date/Time, Sources, …)
|
|
-- Ergänzt die Vorlage aus 044 für besseres Matching; Import-Logik unverändert (Apple-Aggregat-Parser).
|
|
|
|
UPDATE csv_field_mappings
|
|
SET
|
|
column_signature = ARRAY[
|
|
'Date/Time',
|
|
'Start',
|
|
'End',
|
|
'Total Sleep (hr)',
|
|
'Asleep (Unspecified) (hr)',
|
|
'In Bed (hr)',
|
|
'Core (hr)',
|
|
'Deep (hr)',
|
|
'REM (hr)',
|
|
'Awake (hr)',
|
|
'Sources'
|
|
]::TEXT[],
|
|
description = COALESCE(
|
|
description,
|
|
'Apple-Health-Schlafanalyse (Nacht-Zusammenfassung): Spalten wie Date/Time, Start/End mit Zeitzone, Kern/Tief/REM etc.'
|
|
),
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE is_system = true
|
|
AND profile_id IS NULL
|
|
AND module = 'sleep'
|
|
AND mapping_name = 'Apple Health Schlaf (Schlafanalyse / Nacht)';
|