mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-06 12:01:14 +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
|
# Single query: per-label COUNT and top-N ranking by start_time computed
|
||||||
# via window functions in a CTE, then filtered to rn <= limit
|
# 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")
|
event_count = (
|
||||||
rn = fn.ROW_NUMBER().over(
|
fn.COUNT(Event.id).over(partition_by=[Event.label]).alias("event_count")
|
||||||
partition_by=[Event.label], order_by=[Event.start_time.desc()]
|
|
||||||
).alias("rn")
|
|
||||||
|
|
||||||
base_query = (
|
|
||||||
Event.select(
|
|
||||||
*explore_columns,
|
|
||||||
event_count,
|
|
||||||
rn,
|
|
||||||
)
|
|
||||||
.where(Event.camera << allowed_cameras)
|
|
||||||
)
|
)
|
||||||
|
rn = (
|
||||||
|
fn.ROW_NUMBER()
|
||||||
|
.over(partition_by=[Event.label], order_by=[Event.start_time.desc()])
|
||||||
|
.alias("rn")
|
||||||
|
)
|
||||||
|
|
||||||
|
base_query = Event.select(
|
||||||
|
*explore_columns,
|
||||||
|
event_count,
|
||||||
|
rn,
|
||||||
|
).where(Event.camera << allowed_cameras)
|
||||||
ranked = base_query.cte("ranked")
|
ranked = base_query.cte("ranked")
|
||||||
query = (
|
query = (
|
||||||
Event.select(
|
Event.select(
|
||||||
@ -482,9 +483,7 @@ def events_explore(
|
|||||||
"false_positive": event.false_positive,
|
"false_positive": event.false_positive,
|
||||||
"box": event.box,
|
"box": event.box,
|
||||||
"data": {
|
"data": {
|
||||||
k: v
|
k: v for k, v in (event.data or {}).items() if k in allowed_data_keys
|
||||||
for k, v in (event.data or {}).items()
|
|
||||||
if k in allowed_data_keys
|
|
||||||
},
|
},
|
||||||
"event_count": event.event_count,
|
"event_count": event.event_count,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user