Publish finished reviews to mqtt / ws and use that for source of update banner (#10072)

* Add reviews to frontend

* Update ready when new review is saved

* fix

* Formatting
This commit is contained in:
Nicolas Mowen
2024-02-27 06:37:39 -07:00
committed by GitHub
parent 00c2caa1b7
commit f95ce913b1
6 changed files with 53 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
"""Maintain review segments in db."""
import json
import logging
import os
import random
@@ -138,7 +139,14 @@ class ReviewSegmentMaintainer(threading.Thread):
def end_segment(self, segment: PendingReviewSegment) -> None:
"""End segment."""
self.requestor.send_data(UPSERT_REVIEW_SEGMENT, segment.end())
seg_data = segment.end()
self.requestor.send_data(UPSERT_REVIEW_SEGMENT, seg_data)
self.requestor.send_data(
"reviews",
json.dumps(
{"type": "end", "review": {k.name: v for k, v in seg_data.items()}}
),
)
self.active_review_segments[segment.camera] = None
def update_existing_segment(