parent
fe4bde32ba
commit
a7296c943b
2 changed files with 14 additions and 0 deletions
|
|
@ -133,6 +133,14 @@ class Trip:
|
|||
"""Countries flags for trip."""
|
||||
return "".join(c.flag for c in self.countries)
|
||||
|
||||
def total_distance(self) -> float | None:
|
||||
"""Total distance for trip."""
|
||||
return (
|
||||
sum(t["distance"] for t in self.travel)
|
||||
if all(t.get("distance") for t in self.travel)
|
||||
else None
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Holiday:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue