Handle case when no events are found for a given tracking number.

- Added handling for case when no events are found for a given tracking number.
This commit is contained in:
Kumi 2023-08-26 07:29:25 +02:00
parent e5967c7692
commit ebe1eff2f4
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -121,6 +121,10 @@ class Tracker:
events = sorted(events, key=lambda x: x.event_time, reverse=True) events = sorted(events, key=lambda x: x.event_time, reverse=True)
if not events:
logging.debug(f"No events found for {shipment.tracking_number}")
return
if latest_known_event: if latest_known_event:
logging.debug( logging.debug(
f"Latest known event for {shipment.tracking_number}: {latest_known_event.event_description} - {latest_known_event.event_time}" f"Latest known event for {shipment.tracking_number}: {latest_known_event.event_description} - {latest_known_event.event_time}"