From 526e6d34392de52ab4d78d4546c0c29cecc90d27 Mon Sep 17 00:00:00 2001 From: ahosking Date: Thu, 3 Nov 2022 00:05:56 -0400 Subject: [PATCH] Extend Data search to 90 days Add Winter value to the data selected and passed to index --- influx_frontend.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/influx_frontend.py b/influx_frontend.py index 943ca41..2adb7e9 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -27,7 +27,7 @@ def success(): def main_page(): query_api = client.query_api() query = 'from(bucket: "gas")\ - |> range(start: -30d)\ + |> range(start: -90d)\ |> filter(fn: (r) => r["_measurement"] == "2016_odyssey")\ |> filter(fn: (r) => r["_field"] == "odometer")\ |> sort(columns: ["_value"], desc: false)\ @@ -50,6 +50,10 @@ def main_page(): temp['fuelcost'] = record['fuelcost'] except KeyError: pass + try: + temp['winter'] = record['winter'] + except KeyError: + pass results.append(temp) # .append((record.get_time(), record.get_field(), record.get_value())) newlist = sorted(results, key=itemgetter('time'), reverse=True)