From d274d41970131244e40faecb5b749b4d19b971fe Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Fri, 25 Jul 2025 16:42:03 +0200 Subject: Added the court deletion because of duplicate creation --- app/controller.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/controller.py') diff --git a/app/controller.py b/app/controller.py index 3bfce38..d5bdbcb 100644 --- a/app/controller.py +++ b/app/controller.py @@ -24,10 +24,9 @@ from app.utilities import ( class Courts: def __init__(self): with app.app_context(): - courts = db.session.query(Court).all() - if len(courts) == 0: - for _ in range(app.config["COURT_COUNT"]): - db.session.add(Court()) + db.session.query(Court).delete() + for _ in range(app.config["COURT_COUNT"]): + db.session.add(Court()) db.session.commit() def get(self, id: int) -> Court: -- cgit v1.3.1