mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-09-17 16:52:47 +00:00
add exact match notice on stations helper function
This commit is contained in:
@@ -21,10 +21,9 @@ headers = {
|
||||
endpoint = "https://api.transitous.org"
|
||||
|
||||
def check_stations():
|
||||
logger(f"Testing {len(station_names)} stations...")
|
||||
all_stations_output = {}
|
||||
minimal_overview = {
|
||||
"stations": {}
|
||||
}
|
||||
minimal_overview = {}
|
||||
|
||||
for station in station_names:
|
||||
req = f"{endpoint}/api/v1/geocode"
|
||||
@@ -54,8 +53,8 @@ def check_stations():
|
||||
"tz": entry.get("tz"),
|
||||
"country": entry.get("country"),
|
||||
"coords": coords,
|
||||
"modes": modes,
|
||||
"id": station_id,
|
||||
"modes": modes,
|
||||
}
|
||||
|
||||
if stop_name:
|
||||
@@ -64,7 +63,6 @@ def check_stations():
|
||||
|
||||
if stop_name == station:
|
||||
if not exact_match:
|
||||
logger(f"Exact match found! {station} is an assigned station! Bot would use that station directly")
|
||||
exact_match = True
|
||||
|
||||
if not stops_dict:
|
||||
@@ -72,10 +70,14 @@ def check_stations():
|
||||
continue
|
||||
|
||||
all_stations_output[station] = {
|
||||
"exact_match": exact_match,
|
||||
"associated": stops_dict
|
||||
}
|
||||
|
||||
minimal_overview["stations"][station] = aliases_list
|
||||
minimal_overview[station] = {
|
||||
"exact_match": exact_match,
|
||||
"names": aliases_list
|
||||
}
|
||||
|
||||
logger(json.dumps(minimal_overview, indent=4, ensure_ascii=False))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user