From d1c5c6ed61aaa4ad5b24b87cb542149d267d048f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:21:53 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/update_tilt.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/update_tilt.py b/scripts/update_tilt.py index 401e200..cfbed54 100644 --- a/scripts/update_tilt.py +++ b/scripts/update_tilt.py @@ -1,10 +1,12 @@ """ We noticed that for lots of the passive sites, the tilt was wrong in the database.""" import os -from pvconsumer.solar_sheffield_passiv import get_all_systems_from_solar_sheffield + from pvsite_datamodel.connection import DatabaseConnection from pvsite_datamodel.read.site import get_all_sites +from pvconsumer.solar_sheffield_passiv import get_all_systems_from_solar_sheffield + url = os.getenv("SS_URL") user_id = os.getenv("SS_USER_ID") key = os.getenv("SS_KEY") @@ -20,7 +22,9 @@ sites_found = 0 for site in sites: - all_pv_systems_df_temp = all_pv_systems_df[all_pv_systems_df['pv_system_id'] == site.client_site_id] + all_pv_systems_df_temp = all_pv_systems_df[ + all_pv_systems_df["pv_system_id"] == site.client_site_id + ] if len(all_pv_systems_df_temp) == 0: print(f"Site {site.client_site_id} not found in solar sheffield") @@ -31,13 +35,12 @@ old_tilt = site.tilt new_tilt = all_pv_systems_df_temp.iloc[0].tilt print(f"Old tilt: {old_tilt}, new tilt: {new_tilt}") - if new_tilt != 'None': + if new_tilt != "None": new_tilt = float(new_tilt) - if (new_tilt != 'None') and (new_tilt is not None) and (old_tilt != new_tilt): + if (new_tilt != "None") and (new_tilt is not None) and (old_tilt != new_tilt): site.tilt = new_tilt print(f"Updated tilt for site {site.client_site_id} from {old_tilt} to {new_tilt}") session.commit() - print(f"Found {sites_found} sites in solar sheffield")