Skip to content

Commit

Permalink
feat: update mongodb script
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavilien committed Feb 7, 2025
1 parent 68ba0ed commit 1f783ce
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions scripts/populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,16 @@ def create_schedule_items():

def append_shirt_size_to_dietary_restrictions():
for document in helix_db["profiles"].find():
dietary_restrictions = document.get('dietaryRestrictions', '')
dietary_restrictions = document.get('dietaryRestrictions', [])
shirt_size = document.get('shirtSize', '')

if dietary_restrictions:
updated_dietary_restrictions = f"{dietary_restrictions}, {shirt_size}"
else:
updated_dietary_restrictions = shirt_size

print(updated_dietary_restrictions)
# helix_db.update_one(
# {'_id': document['_id']},
# {'$set': {'dietary_restrictions': updated_dietary_restrictions}}
# )
dietary_restrictions.append(f'Shirt size: {shirt_size}')
print(f"Updated {document.get("firsteName", "")}")
helix_db["profiles"].update_one(
{'_id': document['_id']},
{'$set': {'dietary_restrictions': dietary_restrictions}}
)


if __name__=='__main__':
Expand Down

0 comments on commit 1f783ce

Please sign in to comment.