forked from Github/frigate
Add ability to filter Explore by Frigate+ submission status (#14909)
* backend * add is_submitted to query params * add submitted filter to dialog * allow is_submitted filter selection with input
This commit is contained in:
@@ -47,6 +47,7 @@ class EventsSearchQueryParams(BaseModel):
|
||||
time_range: Optional[str] = DEFAULT_TIME_RANGE
|
||||
has_clip: Optional[bool] = None
|
||||
has_snapshot: Optional[bool] = None
|
||||
is_submitted: Optional[bool] = None
|
||||
timezone: Optional[str] = "utc"
|
||||
min_score: Optional[float] = None
|
||||
max_score: Optional[float] = None
|
||||
|
||||
@@ -360,6 +360,7 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
|
||||
time_range = params.time_range
|
||||
has_clip = params.has_clip
|
||||
has_snapshot = params.has_snapshot
|
||||
is_submitted = params.is_submitted
|
||||
|
||||
# for similarity search
|
||||
event_id = params.event_id
|
||||
@@ -441,6 +442,12 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
|
||||
if has_snapshot is not None:
|
||||
event_filters.append((Event.has_snapshot == has_snapshot))
|
||||
|
||||
if is_submitted is not None:
|
||||
if is_submitted == 0:
|
||||
event_filters.append((Event.plus_id.is_null()))
|
||||
elif is_submitted > 0:
|
||||
event_filters.append((Event.plus_id != ""))
|
||||
|
||||
if min_score is not None and max_score is not None:
|
||||
event_filters.append((Event.data["score"].between(min_score, max_score)))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user