Refactor event sorting and logging in Tracker class
- Sort events in descending order based on event time. - Update debug logging message to include event description and time.
This commit is contained in:
parent
1ae1a88975
commit
e71a30630d
1 changed files with 1 additions and 0 deletions
|
@ -89,6 +89,7 @@ class Tracker:
|
|||
latest_known_event = self.db.get_latest_event(shipment_id)
|
||||
|
||||
events = self.query_api(tracking_number, carrier)
|
||||
events = sorted(events, key=lambda x: x.event_time, reverse=True)
|
||||
|
||||
if latest_known_event:
|
||||
logging.debug(f"Latest known event for {tracking_number}: {latest_known_event.event_description} - {latest_known_event.event_time}")
|
||||
|
|
Loading…
Reference in a new issue