From 7e0de3f0324b92ac01e4810a4f83d2c3436752f0 Mon Sep 17 00:00:00 2001 From: WorldTeacher <41587052+WorldTeacher@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:46:15 +0200 Subject: [PATCH] db bug fix --- src/backend/database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/database.py b/src/backend/database.py index 58fa213..29b082d 100644 --- a/src/backend/database.py +++ b/src/backend/database.py @@ -658,12 +658,16 @@ class Database: Returns: Optional[int]: the id of the professor, if the professor is not found, None is returned """ - + # get list of all current profs + profs = self.getProfs() + if profs == []: + return 1 data = self.getProfByName(prof_name.replace(",", "")) if data is None: # get last used id and return id + 1 profno = self.query_db("SELECT id FROM prof ORDER BY id DESC", one=True)[0] return profno + 1 + # return None else: return data[0]