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:
23
utils.py
Normal file
23
utils.py
Normal 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()
|
||||
Reference in New Issue
Block a user