From 0af04f400508688b426883728cce8cfb4d1a8f68 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 24 Aug 2023 08:57:06 -0600 Subject: [PATCH] Fix sql --- frigate/events/cleanup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frigate/events/cleanup.py b/frigate/events/cleanup.py index be35e2096..793e01293 100644 --- a/frigate/events/cleanup.py +++ b/frigate/events/cleanup.py @@ -168,16 +168,16 @@ class EventCleanup(threading.Thread): camera, has_snapshot, has_clip, + end_time, row_number() over ( partition by label, camera, round(start_time/5,0)*5 - where end_time is not null order by end_time-start_time desc ) as copy_number from event ) 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) for event in duplicate_events: