From 605648bc33854f9a70055d8e7e5f6c5aab1f5f8e Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Sat, 15 Feb 2025 11:34:11 +0000 Subject: [PATCH] Fix currency format issue when page is loaded outside HA wrapper https://github.com/springfall2008/batpred/issues/1996 --- apps/predbat/web.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/predbat/web.py b/apps/predbat/web.py index e9b3e814..105cf7d5 100644 --- a/apps/predbat/web.py +++ b/apps/predbat/web.py @@ -21,7 +21,6 @@ TIME_FORMAT_DAILY = "%Y-%m-%d" - class WebInterface: def __init__(self, base) -> None: self.abort = False @@ -73,7 +72,7 @@ def history_attribute(self, history, state_key="state", last_updated_key="last_u try: state = float(state) * scale if pounds: - state = dp2(state / 100) + state = dp2(state/100) last_updated_time = item[last_updated_key] last_updated_stamp = str2time(last_updated_time) except (ValueError, TypeError): @@ -120,10 +119,10 @@ def history_update(self): self.cost_yesterday_car_hist = self.history_attribute(self.base.get_history_wrapper(self.base.prefix + ".cost_yesterday_car", 28), daily=True, offset_days=-1, pounds=True) self.cost_yesterday_no_car = self.subtract_daily(self.cost_yesterday_hist, self.cost_yesterday_car_hist) - compare_list = self.base.get_arg("compare_list", []) + compare_list = self.base.get_arg('compare_list', []) for item in compare_list: id = item.get("id", None) - if id and self.base.comparison: + if id and self.base.comparison: self.compare_hist[id] = {} result = self.base.comparison.get_comparison(id) if result: @@ -230,7 +229,7 @@ def get_header(self, title, refresh=0): """ Return the HTML header for a page """ - text = "