This commit is contained in:
Nicolas Mowen 2023-08-24 08:57:06 -06:00 committed by GitHub
parent f8532f515c
commit 0af04f4005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,16 +168,16 @@ class EventCleanup(threading.Thread):
camera, camera,
has_snapshot, has_snapshot,
has_clip, has_clip,
end_time,
row_number() over ( row_number() over (
partition by label, camera, round(start_time/5,0)*5 partition by label, camera, round(start_time/5,0)*5
where end_time is not null
order by end_time-start_time desc order by end_time-start_time desc
) as copy_number ) as copy_number
from event from event
) )
select distinct id, camera, has_snapshot, has_clip from grouped_events select distinct id, camera, has_snapshot, has_clip from grouped_events
where copy_number > 1;""" where copy_number > 1 and end_time not null;"""
duplicate_events = Event.raw(duplicate_query) duplicate_events = Event.raw(duplicate_query)
for event in duplicate_events: for event in duplicate_events: