Fallback to tag for any AfterShip tracking that have no checkpoints ()

pull/45080/head
Joakim Sørensen 2021-01-12 10:33:14 +01:00 committed by GitHub
parent e83ced6737
commit 8ce32d67f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
homeassistant/components/aftership

View File

@ -181,8 +181,8 @@ class AfterShipSensor(Entity):
track["tracking_number"] if track["title"] is None else track["title"]
)
last_checkpoint = (
"Shipment pending"
if track["tag"] == "Pending"
f"Shipment {track['tag'].lower()}"
if not track["checkpoints"]
else track["checkpoints"][-1]
)
status_counts[status] = status_counts.get(status, 0) + 1