mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-21 03:41:55 +03:00
Editor fail, re-ruff format.
This commit is contained in:
parent
9fa345f192
commit
c575fb223b
@ -412,19 +412,20 @@ def events_explore(
|
||||
|
||||
# Single query: per-label COUNT and top-N ranking by start_time computed
|
||||
# via window functions in a CTE, then filtered to rn <= limit
|
||||
event_count = fn.COUNT(Event.id).over(partition_by=[Event.label]).alias("event_count")
|
||||
rn = fn.ROW_NUMBER().over(
|
||||
partition_by=[Event.label], order_by=[Event.start_time.desc()]
|
||||
).alias("rn")
|
||||
event_count = (
|
||||
fn.COUNT(Event.id).over(partition_by=[Event.label]).alias("event_count")
|
||||
)
|
||||
rn = (
|
||||
fn.ROW_NUMBER()
|
||||
.over(partition_by=[Event.label], order_by=[Event.start_time.desc()])
|
||||
.alias("rn")
|
||||
)
|
||||
|
||||
base_query = (
|
||||
Event.select(
|
||||
base_query = Event.select(
|
||||
*explore_columns,
|
||||
event_count,
|
||||
rn,
|
||||
)
|
||||
.where(Event.camera << allowed_cameras)
|
||||
)
|
||||
).where(Event.camera << allowed_cameras)
|
||||
ranked = base_query.cte("ranked")
|
||||
query = (
|
||||
Event.select(
|
||||
@ -482,9 +483,7 @@ def events_explore(
|
||||
"false_positive": event.false_positive,
|
||||
"box": event.box,
|
||||
"data": {
|
||||
k: v
|
||||
for k, v in (event.data or {}).items()
|
||||
if k in allowed_data_keys
|
||||
k: v for k, v in (event.data or {}).items() if k in allowed_data_keys
|
||||
},
|
||||
"event_count": event.event_count,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user