Fixed rtDuration and transferCount
This commit is contained in:
parent
947e6361f6
commit
7b0f2c31ed
@ -19,9 +19,18 @@ class Trip():
|
|||||||
self.id = data["tripId"]
|
self.id = data["tripId"]
|
||||||
self.ctx_recon = data["ctxRecon"]
|
self.ctx_recon = data["ctxRecon"]
|
||||||
self.duration = parse_duration(data["duration"])
|
self.duration = parse_duration(data["duration"])
|
||||||
|
|
||||||
|
if "rtDuration" in data:
|
||||||
self.real_time_duration = parse_duration(data["rtDuration"])
|
self.real_time_duration = parse_duration(data["rtDuration"])
|
||||||
|
else:
|
||||||
|
self.real_time_duration = None
|
||||||
|
|
||||||
self.checksum = data["checksum"]
|
self.checksum = data["checksum"]
|
||||||
|
|
||||||
|
if "transferCount" in data:
|
||||||
self.transfer_count = data["transferCount"]
|
self.transfer_count = data["transferCount"]
|
||||||
|
else:
|
||||||
|
self.transfer_count = 0
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return f"Trip from {self.origin.name} to {self.destination.name} lasting {self.duration} ({self.real_time_duration}) with {len(self.legs)} legs and {self.transfer_count} transfers"
|
return f"Trip from {self.origin.name} to {self.destination.name} lasting {self.duration} ({self.real_time_duration}) with {len(self.legs)} legs and {self.transfer_count} transfers"
|
Loading…
Reference in New Issue
Block a user