From 60db4d9110ac1e16943087a66d9594fd2732583f Mon Sep 17 00:00:00 2001 From: Brad Hubbard-Nelson Date: Sun, 22 Oct 2023 20:05:43 -0400 Subject: [PATCH] Version 4.12.22 minor bug fixes --- src/_main_/config/build/deployConfig.json | 2 +- src/api/store/download.py | 6 ++---- src/api_version_dev.txt | 2 +- src/carbon_calculator/CCDefaults.py | 4 ++-- src/deployment/build.json | 2 +- src/task_queue/database_tasks/update_actions_content.py | 3 +-- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/_main_/config/build/deployConfig.json b/src/_main_/config/build/deployConfig.json index cbee372f7..69d7e54b2 100644 --- a/src/_main_/config/build/deployConfig.json +++ b/src/_main_/config/build/deployConfig.json @@ -1,6 +1,6 @@ { "IS_PROD": false, "IS_CANARY": false, - "BUILD_VERSION": "4.12.21", + "BUILD_VERSION": "4.12.22", "BUILD_VERSION_NOTES": "Feb 24: Admin portal pagination:\n- deliver content in small chunks" } \ No newline at end of file diff --git a/src/api/store/download.py b/src/api/store/download.py index cae7baad2..503c076d9 100644 --- a/src/api/store/download.py +++ b/src/api/store/download.py @@ -421,7 +421,7 @@ def _get_user_actions_cells(self, user, actions, teams): } return self._get_cells_from_dict(self.user_info_columns_new, user_cells) - # Recieves an action, returns how many times it's been marked as Done in the last 30 days + # Receives an action, returns how many times it's been marked as Done in the last 30 days def _get_last_30_days_count(self, action): today = datetime.date.today() thirty_days_ago = today - timezone.timedelta(days = 30) @@ -434,9 +434,8 @@ def _get_last_30_days_count(self, action): #Gets row information for the All Actions CSV and the All Communities and Actions CSV def _get_action_info_cells(self, action): - average_carbon_points = ( - AverageImpact(action.calculator_action, action.date_completed) + AverageImpact(action.calculator_action) if action.calculator_action else int(action.average_carbon_score) if action.average_carbon_score.isdigit() @@ -1007,7 +1006,6 @@ def _community_actions_download(self, community_id): columns = self.action_info_columns data = [columns] - for action in actions: data.append(self._get_action_info_cells(action)) diff --git a/src/api_version_dev.txt b/src/api_version_dev.txt index 674195711..af7ca6b1e 100644 --- a/src/api_version_dev.txt +++ b/src/api_version_dev.txt @@ -1 +1 @@ -4.12.21 \ No newline at end of file +4.12.22 \ No newline at end of file diff --git a/src/carbon_calculator/CCDefaults.py b/src/carbon_calculator/CCDefaults.py index 9028d39c1..5101a56cd 100644 --- a/src/carbon_calculator/CCDefaults.py +++ b/src/carbon_calculator/CCDefaults.py @@ -43,7 +43,7 @@ def loadDefaults(self): cq = CalcDefault.objects.all() for c in cq: # valid date is 0 if not specified - date = '2000-01-01' + date = datetime.strptime('2000-01-01','%Y-%m-%d').date() if c.valid_date != None: date = c.valid_date @@ -91,7 +91,7 @@ def getDefault(self, locality, variable, date, default=None): value = var["values"][-1] else: for i in range(len(var["valid_dates"])): - valid_date = datetime.strptime(var["valid_dates"][i], '%Y-%m-%d').date() + valid_date = var["valid_dates"][i] if valid_date < date: value = var["values"][i] return value diff --git a/src/deployment/build.json b/src/deployment/build.json index 58e0a5c95..531932d32 100644 --- a/src/deployment/build.json +++ b/src/deployment/build.json @@ -1,5 +1,5 @@ { - "dev": "4.12.21", + "dev": "4.12.22", "prod": "4.12.1", "canary": "4.12.1" } \ No newline at end of file diff --git a/src/task_queue/database_tasks/update_actions_content.py b/src/task_queue/database_tasks/update_actions_content.py index 9878f44cd..8b95ba76d 100644 --- a/src/task_queue/database_tasks/update_actions_content.py +++ b/src/task_queue/database_tasks/update_actions_content.py @@ -83,7 +83,7 @@ def update_actions_content(task=None): ccActionName = item[t["Carbon Calculator Action"]] # locate the Action from title and community - action = Action.objects.filter(title=action_title, community=community) + action = Action.objects.filter(title=action_title, community=community, is_deleted=False) if action: action = action.first() @@ -112,7 +112,6 @@ def update_actions_content(task=None): print("Carbon calculator action '"+ccActionName+"' does not exist") continue action.calculator_action = ccAction.first() - action.save()