Rolled back code

This commit is contained in:
Verox001 2024-01-30 09:55:44 +01:00
parent 428e2498dd
commit 27fbebca98

28
app.py
View File

@ -126,8 +126,9 @@ def index():
habits = [] habits = []
name = "Bitte melde dich an." name = "Bitte melde dich an."
# old code # Add checked attribute to habits (if they have been checked today)
"""trackings = habit.get_habitTrackings() for habit in habits:
trackings = habit.get_habitTrackings()
for tracking in trackings: for tracking in trackings:
# day # day
if habit.unit == 0: if habit.unit == 0:
@ -150,16 +151,6 @@ def index():
habit.checked = True habit.checked = True
break break
else:
habit.checked = False"""
# Add checked attribute to habits (if they have been checked today)
for habit in habits:
trackings = habit.get_habitTrackings()
for tracking in trackings:
if tracking.created_at.date() == datetime.date.today():
habit.checked = True
break
else: else:
habit.checked = False habit.checked = False
@ -333,7 +324,7 @@ def check_habit():
trackings = habit.get_habitTrackings() trackings = habit.get_habitTrackings()
# Check if habit has been tracked today # Check if habit has been tracked today
"""delete_tracking = None delete_tracking = None
for tracking in trackings: for tracking in trackings:
# day # day
if habit.unit == 0: if habit.unit == 0:
@ -356,17 +347,6 @@ def check_habit():
delete_tracking = tracking delete_tracking = tracking
break break
if not delete_tracking:
HabitTrackings.create(habit_id, 1)
else:
delete_tracking.delete()"""
delete_tracking = None
for tracking in trackings:
if tracking.created_at.date() == datetime.date.today():
delete_tracking = tracking
break
if not delete_tracking: if not delete_tracking:
HabitTrackings.create(habit_id, 1) HabitTrackings.create(habit_id, 1)
else: else: