Skip to content

Commit

Permalink
Fix for tomorrow times
Browse files Browse the repository at this point in the history
The definition for tomorrow only looked at the first part of the query, fixed to include results from second part
  • Loading branch information
vingerha committed Mar 7, 2024
1 parent d5f54cf commit 4d91a04
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions custom_components/gtfs2/gtfs_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,14 @@ def get_next_departure(self):

# Format arrival and departure dates and times, accounting for the
# possibility of times crossing over midnight.
_tomorrow = item.get("tomorrow")
_tomorrow = False
if item.get("tomorrow") == 1 or item.get("calendar_date") > now_date:
_tomorrow = True
_LOGGER.debug("Time is 'tomorrow': %s ,based on -> tomorrow_val: %s, calendar_date val: %s, now_date val: %s", _tomorrow, item.get("tomorrow"),item.get("calendar_date"), now_date)
origin_arrival = now
dest_arrival = now
origin_depart_time = f"{now_date} {item['origin_depart_time']}"
if _tomorrow == 1 and now_time > item['origin_depart_time']:
if _tomorrow and now_time > item['origin_depart_time']:
origin_arrival = tomorrow
dest_arrival = tomorrow
origin_depart_time = f"{tomorrow_date} {item['origin_depart_time']}"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/gtfs2/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
},
"route_type": {
"options": {
"2": "üge, Intercity- oder Fernreisen (manuell im nächsten Bildschirm eingegeben)",
"99": "Alle, außer Züge (Auswahl aus Haltestellen im nächsten Bildschirm)"
"2": "Züge, zwischen manuell eingegebene Städte (nächsten Bildschirm)",
"99": "Alle, außer Züge, zwischen ausgewählte Haltestellen (nächsten Bildschirm)"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions custom_components/gtfs2/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
},
"route_type": {
"options": {
"99": "All, excluding trains (selecting from stops in next screen)",
"2": "Trains, intercity or long-distance travel (manually entered in next screen)"
"99": "All but trains, between selected stops (next screen)",
"2": "Trains only, between manually entered cities (next screen)"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions custom_components/gtfs2/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@
},
"route_type": {
"options": {
"2": "Voyages ferroviaires, interurbains ou longue distance",
"99": "Tout, à part des ferroviaires"
"2": "Voyages ferroviaires, entre villes manuellement définiés (prochain écran)",
"99": "Tout à part des ferroviaires, entre stops sélectionnés (prochain écran)"
}
}
},
Expand Down

0 comments on commit 4d91a04

Please sign in to comment.