from app.models.habit import ALL_WEEKDAYS_MASK from app.services.log_service import MILESTONE_STREAKS _DAY_LABELS = ["월", "화", "수", "목", "금", "토", "일"] def is_milestone_streak(streak: int) -> bool: return streak in MILESTONE_STREAKS def weekday_label(mask: int) -> str: if mask == ALL_WEEKDAYS_MASK: return "매일" days = [label for i, label in enumerate(_DAY_LABELS) if mask & (1 << i)] return ", ".join(days) if days else "선택된 요일 없음" def heatmap_opacity(checked_count: int, scheduled_count: int) -> float: """월별 캘린더 히트맵 셀의 배경 투명도(0~0.9)를 계산한다.""" if not scheduled_count: return 0.0 ratio = checked_count / scheduled_count if ratio <= 0: return 0.0 return round(0.12 + ratio * 0.78, 2)