mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-09-17 16:52:47 +00:00
transitous rewrite: only show next_stop if its actually stop and not the beginn of the route
This commit is contained in:
+1
-3
@@ -127,14 +127,12 @@ async def _update_next_loop(bot: discord.Bot, voice_channel: discord.VoiceChanne
|
|||||||
if trip is None:
|
if trip is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
'''
|
|
||||||
now = datetime.now(LOCAL_TZ)
|
now = datetime.now(LOCAL_TZ)
|
||||||
departure_dt = trip["departure_dt"]
|
departure_dt = trip["departure_dt"]
|
||||||
|
|
||||||
if departure_dt > now:
|
if departure_dt > now:
|
||||||
wait_seconds = (departure_dt - now).total_seconds()
|
wait_seconds = (departure_dt - now).total_seconds() + 10
|
||||||
await asyncio.sleep(wait_seconds)
|
await asyncio.sleep(wait_seconds)
|
||||||
'''
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
next_stop = get_next_station(trip["stops"], trip["from"])
|
next_stop = get_next_station(trip["stops"], trip["from"])
|
||||||
|
|||||||
+1
-6
@@ -154,11 +154,6 @@ def get_next_station(stops: dict, train_from: str) -> dict | None:
|
|||||||
for name, info in stops.items():
|
for name, info in stops.items():
|
||||||
arrival_dt = info["arrival"]
|
arrival_dt = info["arrival"]
|
||||||
if arrival_dt >= now:
|
if arrival_dt >= now:
|
||||||
return {
|
|
||||||
"name": name,
|
|
||||||
"arrival": arrival_dt
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
if name == train_from:
|
if name == train_from:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@@ -166,7 +161,7 @@ def get_next_station(stops: dict, train_from: str) -> dict | None:
|
|||||||
"name": name,
|
"name": name,
|
||||||
"arrival": arrival_dt
|
"arrival": arrival_dt
|
||||||
}
|
}
|
||||||
'''
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def format_via_list(stops: dict, via_and: str) -> str:
|
def format_via_list(stops: dict, via_and: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user