aboutsummaryrefslogtreecommitdiff
path: root/app/controller.py
diff options
context:
space:
mode:
authorKaran Jayachandra <karan.jayachandra@nxp.com>2025-07-25 16:42:03 +0200
committerKaran Jayachandra <karan.jayachandra@nxp.com>2025-07-25 16:42:03 +0200
commitd274d41970131244e40faecb5b749b4d19b971fe (patch)
tree0ab1ab6d458c670dc91ece97d616b398b62def53 /app/controller.py
parent38f099ae6ec7e7ae7338402a03654ee6378e4274 (diff)
Added the court deletion because of duplicate creation
Diffstat (limited to 'app/controller.py')
-rw-r--r--app/controller.py7
1 files changed, 3 insertions, 4 deletions
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: