Skip to content

Commit

Permalink
Add is_delayed convenience function
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-zenk committed May 17, 2024
1 parent 6b043e9 commit ac6aa62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions onboardapis/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ def delay(self) -> timedelta:
self.current_station.arrival.actual - self.current_station.arrival.scheduled
).total_seconds())

@property
def is_delayed(self) -> bool:
"""Whether the train is delayed.
Convenience function that tests if `delay > timedelta(0)`.
"""
return self.delay > timedelta()

@property
def distance(self) -> float:
"""
Expand Down

0 comments on commit ac6aa62

Please sign in to comment.