add retroactive check for yesterday's missed habits on /today
Users often only realize a habit was missed the next day; a same-day-only check made it impossible to record it after the fact.
This commit is contained in:
@@ -50,6 +50,13 @@ def get_today_items(db: Session, user_id: int, target_date: date) -> tuple[list[
|
||||
return build_items, quit_items
|
||||
|
||||
|
||||
def get_yesterday_missed_items(db: Session, user_id: int) -> list[TodayItem]:
|
||||
"""어제 예정되어 있었지만 아직 체크하지 않은 습관 목록 (형성+중단 합쳐서, /today 화면의 소급 체크용)."""
|
||||
yesterday = date.today() - timedelta(days=1)
|
||||
build_items, quit_items = get_today_items(db, user_id, yesterday)
|
||||
return [item for item in build_items + quit_items if not item.checked]
|
||||
|
||||
|
||||
def toggle_check(db: Session, habit_id: int, log_date: date) -> bool:
|
||||
"""체크 상태를 반전시키고 토글 후의 체크 여부를 반환한다.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user