Reformating
This commit is contained in:
parent
f0585f22fa
commit
906473cb81
@ -8,6 +8,7 @@ def con3():
|
|||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
|
### User.py ###
|
||||||
def create_user(name: str, email: str, password: str):
|
def create_user(name: str, email: str, password: str):
|
||||||
password = hashlib.sha256(password.encode()).hexdigest()
|
password = hashlib.sha256(password.encode()).hexdigest()
|
||||||
now = datetime.now().isoformat()
|
now = datetime.now().isoformat()
|
||||||
@ -63,6 +64,7 @@ def delete_user(id: int):
|
|||||||
return cursor.lastrowid
|
return cursor.lastrowid
|
||||||
|
|
||||||
|
|
||||||
|
### Habit.py ###
|
||||||
def create_habit(user_id: int, name: str, times: int, unit: int, slot: int, note: str | None=None):
|
def create_habit(user_id: int, name: str, times: int, unit: int, slot: int, note: str | None=None):
|
||||||
now = datetime.now().isoformat()
|
now = datetime.now().isoformat()
|
||||||
query = (f"INSERT INTO habits (user_id, name, note, times, unit, slot, created_at, updated_at) VALUES ('{user_id}', "
|
query = (f"INSERT INTO habits (user_id, name, note, times, unit, slot, created_at, updated_at) VALUES ('{user_id}', "
|
||||||
@ -142,6 +144,7 @@ def delete_habit(id: int):
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
### HabitTrackings.py ###
|
||||||
def create_habitTrackings(habit_id: int, times: int):
|
def create_habitTrackings(habit_id: int, times: int):
|
||||||
now = datetime.now().isoformat()
|
now = datetime.now().isoformat()
|
||||||
query = (
|
query = (
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from models.HabitTrackings import HabitTrackings
|
from models.HabitTrackings import HabitTrackings
|
||||||
from db.SQLiteClient import update_slot, create_habit, get_habit, delete_habit, get_next_slot, \
|
from db.SQLiteClient import create_habit, get_habit,update_habit, delete_habit, get_next_slot, \
|
||||||
get_habitTrackings_by_habit_id, get_slots, update_habit
|
get_habitTrackings_by_habit_id, get_slots, update_slot
|
||||||
|
|
||||||
|
|
||||||
# Unit wird als Integers wie folgt gemessen:
|
# Unit wird als Integers wie folgt gemessen:
|
||||||
@ -42,7 +42,7 @@ class Habit:
|
|||||||
if unit is not None:
|
if unit is not None:
|
||||||
self.unit = unit
|
self.unit = unit
|
||||||
|
|
||||||
# So sollte die Slots Liste aussehen
|
# So sollte die Slots Liste aussehen damit es funktioniert
|
||||||
#[(id, 1), (id, 2), (id, 3), (id, 4), (id, 5)]
|
#[(id, 1), (id, 2), (id, 3), (id, 4), (id, 5)]
|
||||||
def update_slot(self, new_slot: int):
|
def update_slot(self, new_slot: int):
|
||||||
slots = get_slots(self.user_id)
|
slots = get_slots(self.user_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user