Don't limit review summary query (#17835)

* Don't limit review summary query

The /review/summary endpoint was being restricted to the last 30 days, so unreviewed alerts and detections weren't showing in the calendar before that point. This change removes the WHERE clause so that the endpoint returns all results.

* fix

* remove unneeded test

we are now returning all results so we don't need to test for > month_ago

* fix
This commit is contained in:
Josh Hawkins
2025-04-21 11:09:01 -06:00
committed by GitHub
parent 592141daaa
commit a91a2ce4ca
2 changed files with 2 additions and 79 deletions
+2 -3
View File
@@ -176,7 +176,6 @@ async def review_summary(
hour_modifier, minute_modifier, seconds_offset = get_tz_modifiers(params.timezone)
day_ago = (datetime.datetime.now() - datetime.timedelta(hours=24)).timestamp()
month_ago = (datetime.datetime.now() - datetime.timedelta(days=30)).timestamp()
cameras = params.cameras
labels = params.labels
@@ -277,7 +276,7 @@ async def review_summary(
.get()
)
clauses = [(ReviewSegment.start_time > month_ago)]
clauses = []
if cameras != "all":
camera_list = cameras.split(",")
@@ -365,7 +364,7 @@ async def review_summary(
& (UserReviewStatus.user_id == user_id)
),
)
.where(reduce(operator.and_, clauses))
.where(reduce(operator.and_, clauses) if clauses else True)
.group_by(
(ReviewSegment.start_time + seconds_offset).cast("int") / day_in_seconds
)