Cleaned up some of the duplicate and old test files. Got the flex grid to work and the font is okay for now. Can't seem to get darkmode to work across multiple pages from the header. Editing and adding a verse functions were updated.
This commit is contained in:
47
utils.py
47
utils.py
@ -1,42 +1,65 @@
|
||||
import data
|
||||
import requests
|
||||
|
||||
db = data.CON
|
||||
cur = db.cursor()
|
||||
|
||||
|
||||
class Utils():
|
||||
class Utils:
|
||||
def __init__():
|
||||
pass
|
||||
|
||||
def get_unique_people():
|
||||
data = cur.execute('select distinct person from tasks;')
|
||||
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}'")
|
||||
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}'")
|
||||
cur.execute(
|
||||
f"update tasks set status = '{status}' where person = '{person.value}' and verse = '{verse}'"
|
||||
)
|
||||
db.commit()
|
||||
|
||||
def get_persons_incomplete(person):
|
||||
inc = cur.execute(f"select person, verse, verse_passage, club from tasks where status = '0' and person = '{person}'")
|
||||
inc = cur.execute(
|
||||
f"select person, verse, verse_passage, club from tasks where status = '0' and person = '{person}'"
|
||||
)
|
||||
incret = inc.fetchall()
|
||||
return incret
|
||||
|
||||
def edit_verse(person, verse, passage):
|
||||
print(f"update tasks set verse_passage = '{passage.value}' where person = '{person.value}' and verse = '{verse}'")
|
||||
vedit = cur.execute(f"update tasks set verse_passage = '{passage.value}' where person = '{person.value} and verse = '{verse}';")
|
||||
def add_verse(person, verse, passage):
|
||||
club = cur.execute(
|
||||
f"select distinct club from tasks where person = '{person.value}'"
|
||||
)
|
||||
clubstring = club.fetchone()
|
||||
clubstring = "".join(clubstring)
|
||||
cur.execute(
|
||||
f"replace into tasks (person, verse, verse_passage, status, club) values('{person.value}', '{verse.value}', '{passage}', '0', '{clubstring}');"
|
||||
)
|
||||
db.commit()
|
||||
|
||||
def add_person(person):
|
||||
print(person)
|
||||
aperson = cur.execute(f"insert into tasks(person) values ('{person.value}')")
|
||||
def edit_verse(person, verse, passage):
|
||||
passage = passage.value.replace("'", '"')
|
||||
cur.execute(
|
||||
f"update tasks set verse_passage = '{passage}' where person = '{person.value}' and verse = '{verse}'"
|
||||
)
|
||||
db.commit()
|
||||
|
||||
def add_person(person, club):
|
||||
cur.execute(
|
||||
f"insert into tasks(person, club) values ('{person.value}', '{club.value}')"
|
||||
)
|
||||
db.commit()
|
||||
|
||||
def delete_verse(verse, person):
|
||||
dverse = cur.execute(f"delete from tasks where person = '{person.value}' and verse = '{verse}'")
|
||||
cur.execute(
|
||||
f"delete from tasks where person = '{person.value}' and verse = '{verse}'"
|
||||
)
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user