This commit is contained in:
Dona Maria Absi
2025-01-21 18:45:05 +03:00
parent 618bcb03ac
commit f26656de94

View File

@ -54,8 +54,12 @@ ORDER BY device_id, event_date)
select device_id,
event_date,
CONCAT(FLOOR(motion_seconds / 3600), ':', LPAD(FLOOR((motion_seconds % 3600) / 60)::TEXT, 2, '0')) AS motion_formated_duration,
CONCAT(FLOOR(presence_seconds / 3600), ':', LPAD(FLOOR((presence_seconds % 3600) / 60)::TEXT, 2, '0')) AS motion_formated_duration,
CONCAT(FLOOR(none_seconds / 3600), ':', LPAD(FLOOR((none_seconds % 3600) / 60)::TEXT, 2, '0')) AS motion_formated_duration
motion_seconds,
CONCAT(FLOOR(motion_seconds / 3600), ':',LPAD(FLOOR((motion_seconds % 3600) / 60)::TEXT, 2, '0'), ':',LPAD(FLOOR(motion_seconds % 60)::TEXT, 2, '0')) AS motion_formatted_duration,
presence_seconds,
CONCAT(FLOOR(presence_seconds / 3600), ':',LPAD(FLOOR((presence_seconds % 3600) / 60)::TEXT, 2, '0'), ':',LPAD(FLOOR(presence_seconds % 60)::TEXT, 2, '0')) AS presence_formatted_duration,
none_seconds,
CONCAT(FLOOR(none_seconds / 3600), ':',LPAD(FLOOR((none_seconds % 3600) / 60)::TEXT, 2, '0'), ':',LPAD(FLOOR(none_seconds % 60)::TEXT, 2, '0')) AS none_formatted_duration
from duration
order by 1,2