Frontend Update

This commit is contained in:
CasVT
2024-02-23 12:37:10 +01:00
parent 683e2d5524
commit c6590f91dd
24 changed files with 1328 additions and 1090 deletions

View File

@@ -166,6 +166,11 @@ class Reminder:
).fetchone()
reminder = dict(reminder)
reminder["weekdays"] = [
int(n)
for n in reminder["weekdays"].split(",")
if n
] if reminder["weekdays"] else None
reminder['notification_services'] = self._get_notification_services()
return reminder
@@ -277,7 +282,7 @@ class Reminder:
if repeated_reminder:
next_time = _find_next_time(
data["time"],
RepeatQuantity(data["repeat_quantity"]),
RepeatQuantity(data["repeat_quantity"]) if data["repeat_quantity"] else None,
data["repeat_interval"],
weekdays
)
@@ -408,6 +413,12 @@ class Reminders:
(self.user_id,)
)
]
for r in reminders:
r["weekdays"] = [
int(n)
for n in r["weekdays"].split(",")
if n
] if r["weekdays"] else None
# Sort result
reminders.sort(key=sort_by.value[0], reverse=sort_by.value[1])

View File

@@ -23,7 +23,7 @@ class User:
def __init__(self, id: int) -> None:
result = get_db(dict).execute(
"SELECT username, admin FROM users WHERE id = ? LIMIT 1;",
"SELECT username, admin, salt FROM users WHERE id = ? LIMIT 1;",
(id,)
).fetchone()
if not result:
@@ -32,6 +32,7 @@ class User:
self.username: str = result['username']
self.user_id = id
self.admin: bool = result['admin'] == 1
self.salt: bytes = result['salt']
return
@property