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"
|
endpoint = "https://api.transitous.org"
|
||||||
|
|
||||||
def check_stations():
|
def check_stations():
|
||||||
|
logger(f"Testing {len(station_names)} stations...")
|
||||||
all_stations_output = {}
|
all_stations_output = {}
|
||||||
minimal_overview = {
|
minimal_overview = {}
|
||||||
"stations": {}
|
|
||||||
}
|
|
||||||
|
|
||||||
for station in station_names:
|
for station in station_names:
|
||||||
req = f"{endpoint}/api/v1/geocode"
|
req = f"{endpoint}/api/v1/geocode"
|
||||||
@@ -54,8 +53,8 @@ def check_stations():
|
|||||||
"tz": entry.get("tz"),
|
"tz": entry.get("tz"),
|
||||||
"country": entry.get("country"),
|
"country": entry.get("country"),
|
||||||
"coords": coords,
|
"coords": coords,
|
||||||
"modes": modes,
|
|
||||||
"id": station_id,
|
"id": station_id,
|
||||||
|
"modes": modes,
|
||||||
}
|
}
|
||||||
|
|
||||||
if stop_name:
|
if stop_name:
|
||||||
@@ -64,7 +63,6 @@ def check_stations():
|
|||||||
|
|
||||||
if stop_name == station:
|
if stop_name == station:
|
||||||
if not exact_match:
|
if not exact_match:
|
||||||
logger(f"Exact match found! {station} is an assigned station! Bot would use that station directly")
|
|
||||||
exact_match = True
|
exact_match = True
|
||||||
|
|
||||||
if not stops_dict:
|
if not stops_dict:
|
||||||
@@ -72,10 +70,14 @@ def check_stations():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
all_stations_output[station] = {
|
all_stations_output[station] = {
|
||||||
|
"exact_match": exact_match,
|
||||||
"associated": stops_dict
|
"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))
|
logger(json.dumps(minimal_overview, indent=4, ensure_ascii=False))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user