Skip to content

Commit

Permalink
Fix 500 error for new users
Browse files Browse the repository at this point in the history
  • Loading branch information
crocodilestick committed Jan 31, 2025
1 parent 3f204f2 commit 2bcb981
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/cwa_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ def set_default_settings(self, force=False) -> None:
def get_cwa_settings(self) -> dict:
"""Gets the current cwa_settings values from the table of the same name in cwa.db and returns them as a dict"""
self.cur.execute("SELECT * FROM cwa_settings")
if self.cur.fetchall() == []: # If settings table is empty, populates it with default values
self.cur.execute("INSERT INTO cwa_settings DEFAULT VALUES;")
self.con.commit()
headers = [header[0] for header in self.cur.description]
cwa_settings = [dict(zip(headers,row)) for row in self.cur.fetchall()][0]

Expand Down

0 comments on commit 2bcb981

Please sign in to comment.