aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.py b/main.py
index f092eeb..ae842f4 100644
--- a/main.py
+++ b/main.py
@@ -67,13 +67,16 @@ def filter_df(dframe, arguments, loc):
"e10_price": round(e10_price / 100, 2),
"diesel_price": round(diesel_price / 100, 2),
}
- near_stations.append(station_dict)
+ na_dict = {
+ k: (v if v != 0.00 else "N/A") for (k, v) in station_dict.items()
+ }
+ near_stations.append(na_dict)
return near_stations
def sort_stations(stations: list[dict], sort: str) -> list[dict]:
sort_key = SORT_KV.get(sort)
- return sorted(stations, key=lambda d: d[sort_key])
+ return sorted(stations, key=lambda d: d[sort_key] if d[sort_key] != "N/A" else 999)
def output_stations(stations):
git.ajschof.me — hosted by ajschofield — powered by cgit