From 074ddd1edbf3634bc37397e3ba8b4d5ef2932273 Mon Sep 17 00:00:00 2001 From: Kumi Date: Wed, 13 Sep 2023 09:30:31 +0200 Subject: [PATCH] Refactor notification urgency handling in `notify_event` method Previously, the `notify_event` method had a parameter named `critical` to determine the urgency of the notification. This has been changed to `urgent` for clarity. The method now uses the `urgent` parameter directly in the `self.notify` call instead of converting it to an "urgency" string. This commit refactors the code to improve readability and maintainability. --- src/trackbert/classes/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trackbert/classes/core.py b/src/trackbert/classes/core.py index 1f6f623..184bdeb 100644 --- a/src/trackbert/classes/core.py +++ b/src/trackbert/classes/core.py @@ -143,14 +143,14 @@ class Core: for notifier in self.notifiers: notifier.notify(title, message, urgent) - def notify_event(self, shipment, event, critical=False) -> None: + def notify_event(self, shipment, event, urgent=False) -> None: logging.info( f"New event for {shipment.tracking_number}: {event.event_description} - {event.event_time}" ) self.notify( f"New event for {shipment.description or shipment.tracking_number}", event.event_description + " - " + event.event_time, - urgency="critical" if critical else "normal", + urgent=urgent, ) def process_shipment(self, shipment) -> None: