Refactor shipment_id assignment in Tracker and trackers/keydelivery.py
The shipment_id assignment has been refactored in the Tracker class and in the keydelivery.py file to set the value as 0 instead of using the tracking_number. This change ensures consistency in assigning the shipment_id across different trackers.
This commit is contained in:
parent
e71a30630d
commit
a8a7522ff0
3 changed files with 3 additions and 2 deletions
|
@ -102,6 +102,7 @@ class Tracker:
|
|||
|
||||
for event in events:
|
||||
if latest_known_event is None or event.event_time > latest_known_event.event_time:
|
||||
event.shipment_id = shipment_id
|
||||
self.db.write_event(event)
|
||||
|
||||
logging.info(f"New event for {tracking_number}: {event.event_description} - {event.event_time}")
|
||||
|
|
|
@ -24,7 +24,7 @@ class KeyDelivery(BaseTracker):
|
|||
|
||||
for event in events:
|
||||
yield Event(
|
||||
shipment_id = tracking_number,
|
||||
shipment_id = 0,
|
||||
event_time = event["time"],
|
||||
event_description = event["context"],
|
||||
raw_event = json.dumps(event)
|
||||
|
|
|
@ -21,7 +21,7 @@ class PostAT(BaseTracker):
|
|||
py_timestamp = parse(timestamp)
|
||||
event_time = py_timestamp.strftime("%Y-%m-%d %H:%M:%S")
|
||||
yield Event(
|
||||
shipment_id = tracking_number,
|
||||
shipment_id = 0,
|
||||
event_time = event_time,
|
||||
event_description = event["text"],
|
||||
raw_event = json.dumps(event)
|
||||
|
|
Loading…
Reference in a new issue