diff --git a/README.md b/README.md index 79923f6..1c2e5b8 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,6 @@ label + emoji | name ? | freq_den (frequency denominator, either 7 for per week or 30 for per month) ? | freq_num (frequency numerator, how often per week/month. Has to be one for ranges afaik?) ? | highlight (function ??) -label | name ? | position (which vertical position on screen tracker takes. must be unique?) ? | reminder_hour (simple int) ? | reminder_min (simple int) diff --git a/loop/habit_migrator.py b/loop/habit_migrator.py index f0409e3..6f274dd 100644 --- a/loop/habit_migrator.py +++ b/loop/habit_migrator.py @@ -1,18 +1,52 @@ def create_habits(db, trackers): - print("migrating habits, yo") c = db.cursor() tracker = trackers["cigarette"] print(tracker) - # for when the execute works, can be filled in its own function habit = ( - tracker["label"], - 0, - 0, - tracker["id"], + 0, # archived + 11, # color (but nomie: `#369DD3`, loop `2` of available selection) + tracker["label"], # name + "smoking", # description (a little one-liner extended description) + 1, # freq_den (frequency denominator, either 7 for per week or 30 for per month) + 1, # freq_num (frequency numerator, how often per week/month. Has to be one for ranges afaik?) + 0, # highlight (function ??) + 4, # position (which vertical position on screen tracker takes. must be unique?) + 0, # reminder_days (simple int, but i'm not sure how, saw 127) + 0, # type (range,counter [more in nomie]; string in nomie, int in loop) + 0, # target_type (??) + 0.0, # target_value (??) + "c", # unit (text description of value, in nomie set values with `num` being no-value count) + "Did you smoke today?", # question (text question tracker asks) + tracker["id"], # uuid (unique id, must be unique surprisingly) ) c.execute( - """INSERT INTO - Habits(id, name, position, type, uuid) - VALUES (NULL, ?, ?, ?, ?)""", + """INSERT INTO + Habits(id, archived, color, name, description, freq_den, freq_num, highlight, position, reminder_days, type, target_type, target_value, unit, question, uuid) + VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", habit, ) + c.execute("""select * from Habits""") + print(c.fetchall()) + + c.execute( + """ + INSERT INTO + Repetitions(id, habit, timestamp, value) + VALUES (NULL, 5, 1629676800000, 2) + """ + ) + c.execute( + """ + INSERT INTO + Repetitions(id, habit, timestamp, value) + VALUES (NULL, 6, 1629676800000, 2) + """ + ) + + +# grab next tracker info + +# look for unique id of next habit +# if exists skip and warn user + +# insert tracker into habit table