From cb8bf3da4f06dc8353fb23d7272ced39a3f20f50 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 19 Sep 2023 00:11:44 -0400 Subject: [PATCH] doorcontrol: Use enum members instead of raw ids for "red" event types --- doorcontrol/models.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doorcontrol/models.py b/doorcontrol/models.py index a615e88..79b36ca 100644 --- a/doorcontrol/models.py +++ b/doorcontrol/models.py @@ -10,19 +10,19 @@ class HIDEventQuerySet(models.QuerySet): is_red=ExpressionWrapper( Q( event_type__in=[ - 1022, - 1023, - 2024, - 2029, - 2036, - 2042, - 2043, - 2046, - 4041, - 4042, - 4043, - 4044, - 4045, + HIDEvent.EventType.DENIED_ACCESS_CARD_NOT_FOUND, + HIDEvent.EventType.DENIED_ACCESS_ACCESS_PIN_NOT_FOUND, + HIDEvent.EventType.DENIED_ACCESS_SCHEDULE, + HIDEvent.EventType.DENIED_ACCESS_WRONG_PIN, + HIDEvent.EventType.DENIED_ACCESS_CARD_EXPIRED, + HIDEvent.EventType.DENIED_ACCESS_PIN_LOCKOUT, + HIDEvent.EventType.DENIED_ACCESS_UNASSIGNED_CARD, + HIDEvent.EventType.DENIED_ACCESS_PIN_EXPIRED, + HIDEvent.EventType.DOOR_FORCED_ALARM, + HIDEvent.EventType.DOOR_HELD_ALARM, + HIDEvent.EventType.TAMPER_SWITCH_ALARM, + HIDEvent.EventType.AC_FAILURE, + HIDEvent.EventType.BATTERY_FAILURE, ] ), output_field=models.BooleanField(),