Feb-16-2023, 11:52 AM
(Feb-16-2023, 11:20 AM)buran Wrote: https://github.com/Bcopeland64/IU-Habit-.../db.py#L26
DELETE CASCADE //added ON DELETE CASCADE to delete the related entries in completions when a row in habits is deletedThe "comment" is not valid SQL syntax for comment and this raise error.
After removing the comment the error is fixed.
Then when you try to create habit there is problem increate_habit
withdatetime.now()
https://github.com/Bcopeland64/IU-Habit-.../db.py#L32
Youimport datetime
, howeverdatetime
module does not hasnow()
method. You need tofrom datetime import datetime
in order fordatetime.now()
to work.
After fixing the import, there is problem withget_habit
https://github.com/Bcopeland64/IU-Habit-.../db.py#L78
when you instantiateHabit()
you pass more arguments than expected.
At that point I gave up
And something I didn't realise at first glance
You actually never usedb.HabitDB
. You only work withhabit.HabitTracker
. i.e. you never actually use the database part. The instance ofHabitTracker
class is in-memory and all data is lost when program finish
As always, thanks for all of your help. I will go back to the drawing board. I really appreciate your patience.