Add duration property

This commit is contained in:
nemunaire 2016-07-10 19:15:06 +02:00
parent bc05a6f39d
commit c9618a9256

View File

@ -106,7 +106,7 @@ class Trip:
return "From %s at %s to %s at %s // duration: %s // price: %s %s // %s" % (
self.departure_station.name, self.departure_date,
self.arrival_station.name, self.arrival_date,
self.arrival_date - self.departure_date,
self.duration,
self.price, self.currency,
" + ".join([str(s) for s in self.segments])
)
@ -140,6 +140,10 @@ class Trip:
def arrival_station(self):
return self._arrival_station
@property
def duration(self):
return self._arrival_date - self._departure_date
@property
def segments(self):
return self._segments