Moved functions to a util area. Cards on dashboard are organized and based on toggle and db. Cleaned up small functions.

This commit is contained in:
Norm Rasmussen
2024-10-07 15:17:24 -04:00
parent 9279c239b4
commit a05d842a5a
7 changed files with 81 additions and 21 deletions

23
utils.py Normal file
View File

@ -0,0 +1,23 @@
import data
db = data.CON
cur = db.cursor()
class Utils():
def __init__():
pass
def get_unique_people():
data = cur.execute('select distinct person from tasks;')
ppl = data.fetchall()
return ppl
def get_specific_person(person):
res = cur.execute(f"select verse,verse_passage,status from tasks where person='{person.value}'")
dbinfo = res.fetchall()
return dbinfo
def toggle_completion(verse, person, status):
ins = cur.execute(f"update tasks set status = '{status}' where person = '{person.value}' and verse = '{verse}'")
db.commit()