Skip to content

Commit

Permalink
Merge pull request #151 from cuappdev/master
Browse files Browse the repository at this point in the history
Fix amentity duplication issue
  • Loading branch information
vinnie4k authored Apr 16, 2024
2 parents 302e4e6 + 75efb88 commit 455f6f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def create_gym_table():
amenity["type"] = AmenityType[amenity["type"]]
amenities.append(Amenity(**amenity))

# Clear amenities to prevent duplication
db_session.query(Amenity).delete()

# Add to database
[db_session.merge(gym) for gym in gyms]
[db_session.merge(facility) for facility in facilities]
Expand Down

0 comments on commit 455f6f1

Please sign in to comment.