From af02368f6d529de81568673188189f3bc09ad8b8 Mon Sep 17 00:00:00 2001 From: happycastle114 Date: Mon, 6 Nov 2023 11:08:27 +0000 Subject: [PATCH] Formatted with black --- scrap/utils/database.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scrap/utils/database.py b/scrap/utils/database.py index 851c066..77b82d2 100644 --- a/scrap/utils/database.py +++ b/scrap/utils/database.py @@ -32,19 +32,18 @@ def save_to_database(record: ScrapResult): updated_array = [] for councilor in record.councilors: for before_councilor in result: - if councilor.name == before_councilor['name']: - before_councilor['party'] = councilor.party + if councilor.name == before_councilor["name"]: + before_councilor["party"] = councilor.party updated_array.append(before_councilor) - + collection.find_one_and_update( {"councilId": record.council_id}, - {"$set": { - "councilors" : updated_array - }}, upsert=True + {"$set": {"councilors": updated_array}}, + upsert=True, ) else: return False - + return True except Exception as e: print(e)