From 906473cb81aed83b2bc9875f654806314f1de43b Mon Sep 17 00:00:00 2001 From: Yapollon Date: Fri, 26 Jan 2024 09:33:41 +0100 Subject: [PATCH] Reformating --- db/SQLiteClient.py | 3 +++ models/Habit.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/db/SQLiteClient.py b/db/SQLiteClient.py index 08a06c9..b75e1b7 100644 --- a/db/SQLiteClient.py +++ b/db/SQLiteClient.py @@ -8,6 +8,7 @@ def con3(): return conn +### User.py ### def create_user(name: str, email: str, password: str): password = hashlib.sha256(password.encode()).hexdigest() now = datetime.now().isoformat() @@ -63,6 +64,7 @@ def delete_user(id: int): return cursor.lastrowid +### Habit.py ### def create_habit(user_id: int, name: str, times: int, unit: int, slot: int, note: str | None=None): now = datetime.now().isoformat() 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() +### HabitTrackings.py ### def create_habitTrackings(habit_id: int, times: int): now = datetime.now().isoformat() query = ( diff --git a/models/Habit.py b/models/Habit.py index dd5ec8e..30f2b31 100644 --- a/models/Habit.py +++ b/models/Habit.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from models.HabitTrackings import HabitTrackings -from db.SQLiteClient import update_slot, create_habit, get_habit, delete_habit, get_next_slot, \ - get_habitTrackings_by_habit_id, get_slots, update_habit +from db.SQLiteClient import create_habit, get_habit,update_habit, delete_habit, get_next_slot, \ + get_habitTrackings_by_habit_id, get_slots, update_slot # Unit wird als Integers wie folgt gemessen: @@ -42,7 +42,7 @@ class Habit: if unit is not None: 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)] def update_slot(self, new_slot: int): slots = get_slots(self.user_id)