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:
2026-07-19 10:12:17 +09:00
co-authored by Claude Sonnet 5
parent 55918d56d1
commit d212451fe0
15 changed files with 355 additions and 9 deletions
+3 -1
View File
@@ -2,13 +2,14 @@ from datetime import datetime, time
from pydantic import BaseModel, ConfigDict, field_validator
from app.models.habit import ALL_WEEKDAYS_MASK, HabitStatus, HabitType
from app.models.habit import ALL_WEEKDAYS_MASK, HabitDifficulty, HabitStatus, HabitType
class HabitBase(BaseModel):
name: str
habit_type: HabitType
weekdays_mask: int = ALL_WEEKDAYS_MASK
difficulty: HabitDifficulty = HabitDifficulty.MEDIUM
condition_text: str | None = None
reminder_time: time | None = None
@@ -52,6 +53,7 @@ class HabitOut(BaseModel):
habit_type: HabitType
status: HabitStatus
weekdays_mask: int
difficulty: HabitDifficulty
condition_text: str | None
reminder_time: time | None
created_at: datetime