fix: operator precedence makes detection type check always true (#22471)

* fix: operator precedence bug in detection type check

The condition:
  topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value

evaluates as:
  (topic == DetectionTypeEnum.api.value) or (DetectionTypeEnum.lpr.value)

Since DetectionTypeEnum.lpr.value is a non-empty string (truthy), the
second operand is always True regardless of topic. The intended check
is whether topic matches either enum value:
  topic == DetectionTypeEnum.api.value or topic == DetectionTypeEnum.lpr.value

* fix: apply same or operator fix to review/maintainer.py

Same issue as record/maintainer.py — the condition was always true
because the bare enum value is truthy.

* style: ruff format record/maintainer.py
This commit is contained in:
ryzendigo 2026-03-18 22:40:54 +08:00 committed by GitHub
parent 2ace8d3670
commit f658dbb158
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -727,7 +727,8 @@ class RecordingMaintainer(threading.Thread):
)
)
elif (
topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value
topic == DetectionTypeEnum.api.value
or topic == DetectionTypeEnum.lpr.value
):
continue

View File

@ -642,7 +642,10 @@ class ReviewSegmentMaintainer(threading.Thread):
_,
audio_detections,
) = data
elif topic == DetectionTypeEnum.api.value or DetectionTypeEnum.lpr.value:
elif (
topic == DetectionTypeEnum.api.value
or topic == DetectionTypeEnum.lpr.value
):
(
camera,
frame_time,