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.
This commit is contained in:
parent
2eca302234
commit
074ddd1edb
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue