Make data full range

This commit is contained in:
Nick Mowen 2024-01-02 16:02:27 -07:00
parent 6ee7cacaa2
commit f069bf22ab

View File

@ -737,10 +737,33 @@ def hourly_timeline_activity(camera_name: str):
)
check = (key + timedelta(hours=1)).timestamp()
# set initial start so data is representative of full hour
hours[int(key.timestamp())].append(
{
"date": key.timestamp(),
"count": 0,
"type": "motion",
}
)
for recording in all_recordings:
if recording.start_time > check:
hours[int(key.timestamp())].append(
{
"date": (key + timedelta(hours=1)).timestamp(),
"count": 0,
"type": "motion",
}
)
key = key + timedelta(hours=1)
check = (key + timedelta(hours=1)).timestamp()
hours[int(key.timestamp())].append(
{
"date": key.timestamp(),
"count": 0,
"type": "motion",
}
)
data_type = "motion" if recording.objects == 0 else "objects"
hours[int(key.timestamp())].append(