Add duration property
This commit is contained in:
parent
bc05a6f39d
commit
c9618a9256
@ -106,7 +106,7 @@ class Trip:
|
|||||||
return "From %s at %s to %s at %s // duration: %s // price: %s %s // %s" % (
|
return "From %s at %s to %s at %s // duration: %s // price: %s %s // %s" % (
|
||||||
self.departure_station.name, self.departure_date,
|
self.departure_station.name, self.departure_date,
|
||||||
self.arrival_station.name, self.arrival_date,
|
self.arrival_station.name, self.arrival_date,
|
||||||
self.arrival_date - self.departure_date,
|
self.duration,
|
||||||
self.price, self.currency,
|
self.price, self.currency,
|
||||||
" + ".join([str(s) for s in self.segments])
|
" + ".join([str(s) for s in self.segments])
|
||||||
)
|
)
|
||||||
@ -140,6 +140,10 @@ class Trip:
|
|||||||
def arrival_station(self):
|
def arrival_station(self):
|
||||||
return self._arrival_station
|
return self._arrival_station
|
||||||
|
|
||||||
|
@property
|
||||||
|
def duration(self):
|
||||||
|
return self._arrival_date - self._departure_date
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def segments(self):
|
def segments(self):
|
||||||
return self._segments
|
return self._segments
|
||||||
|
Loading…
Reference in New Issue
Block a user