add habit goal-period difficulty and habit formation research notes
Ground the 21-day habit myth in actual research (Lally et al. 2010) and let users pick a target period (21/66/254 days or unlimited) matching that study's easy/median/hard automaticity timelines when creating a habit, with progress shown on the habits list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,7 @@ def create_habit(db: Session, user_id: int, data: HabitCreate) -> Habit:
|
||||
name=data.name,
|
||||
habit_type=data.habit_type,
|
||||
weekdays_mask=data.weekdays_mask,
|
||||
difficulty=data.difficulty,
|
||||
condition_text=data.condition_text,
|
||||
reminder_time=data.reminder_time,
|
||||
status=HabitStatus.ACTIVE,
|
||||
@@ -59,6 +60,7 @@ def update_habit(db: Session, habit: Habit, data: HabitUpdate) -> Habit:
|
||||
habit.name = data.name
|
||||
habit.habit_type = data.habit_type
|
||||
habit.weekdays_mask = data.weekdays_mask
|
||||
habit.difficulty = data.difficulty
|
||||
habit.condition_text = data.condition_text
|
||||
habit.reminder_time = data.reminder_time
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user