feat(project): month-bounded meeting weeks, weekly sales targets, sticky header
- Weeks stay inside the month: week 1 starts on the 1st (through the next Sunday if the 1st is a weekend); a trailing Mon/Tue joins the last week. "Last week" is the previous period. - Prev-week review columns: 전주 업무 | 결과(text, new result_note) | 전주 목표 | 결과(amount). - Header now shows month target, cumulative weekly target, month-to-date sales and gap (amount + %), with decisions/notes beside it; the area stays fixed while scrolling. - Goals board: the monthly sales target is entered per week; the sum becomes the month target. - Migration 020: result_note, goal_week_targets, drop Monday-only check, move absorbed Monday meetings to the new week start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -405,6 +405,10 @@ class MeetingCellMigrationNeeded(RuntimeError):
|
||||
"""회의록 셀 병합 메타데이터(019)가 아직 없다."""
|
||||
|
||||
|
||||
class MeetingMigration020Needed(RuntimeError):
|
||||
"""새 주차(월요일이 아닌 시작일)·결과 글 칸·주차별 목표는 마이그레이션 020 뒤에만 된다."""
|
||||
|
||||
|
||||
GOAL_YEAR = 0 # 업무 영역 글 칸 — 연간
|
||||
# 분기 글 칸(2026-10-01 상·하반기 → 1~4분기). 칸 번호는 예전 반기 칸을 그대로 이어 쓴다 — 데이터 옮기기 없이
|
||||
# 예전 상반기 글(13)은 1분기, 하반기 글(14)은 3분기에 보인다. 2분기(15)·4분기(16)는 마이그레이션 017 뒤에 저장.
|
||||
@@ -663,20 +667,44 @@ def month_last_day(year: int, month: int) -> date:
|
||||
|
||||
|
||||
def month_weeks(year: int, month: int) -> list[tuple[date, date]]:
|
||||
"""그 달의 주(월요일~일요일) 목록 — **1주차 = 그 달 첫 월요일이 있는 주**, 주는 월요일이 속한 달의 것
|
||||
(2026-10-01 사용자 기준). 예: 2026년 10월 = 10/5·12·19·26 주, 9/28~10/4 주는 9월 마지막 주.
|
||||
월간 목표·누적은 이와 따로 늘 1일~말일."""
|
||||
"""그 달의 주차(시작일, 끝일) — 2026-10-07 사용자 기준. 주차는 늘 그 달 안(달을 넘지 않는다).
|
||||
· 1일이 월~금이면 1주차 = 1일 ~ 그 주 일요일(월요일 시작이 아니어도 1주차)
|
||||
· 1일이 토·일이면 1주차 = 1일 ~ 다음 주 일요일(토·일 + 다음 월~일)
|
||||
· 그 뒤는 월~일. 말일이 월·화이면 그 하루·이틀은 앞 주차에 붙는다(마지막 주차 = 월~다음 주 월·화).
|
||||
예: 2026년 10월(1일 목·31일 토) = 10/1~4 · 5~11 · 12~18 · 19~25 · 26~31.
|
||||
월간 목표·누적은 늘 1일~말일."""
|
||||
first = date(year, month, 1)
|
||||
last = month_last_day(year, month)
|
||||
out, mon = [], first + timedelta(days=(7 - first.weekday()) % 7)
|
||||
while mon <= last:
|
||||
out.append((mon, mon + timedelta(days=6)))
|
||||
mon += timedelta(days=7)
|
||||
wd = first.weekday()
|
||||
end = first + timedelta(days=6 - wd + (7 if wd >= 5 else 0))
|
||||
out = [(first, end)]
|
||||
s = end + timedelta(days=1)
|
||||
while s <= last:
|
||||
out.append((s, min(s + timedelta(days=6), last)))
|
||||
s += timedelta(days=7)
|
||||
if len(out) > 1 and last.weekday() <= 1: # 말일이 월·화 — 앞 주차에 붙인다
|
||||
out.pop()
|
||||
out[-1] = (out[-1][0], last)
|
||||
return out
|
||||
|
||||
|
||||
def week_period(d: date) -> tuple[date, date]:
|
||||
"""그 날짜가 든 주차(시작일, 끝일)."""
|
||||
return next(p for p in month_weeks(d.year, d.month) if p[0] <= d <= p[1])
|
||||
|
||||
|
||||
def prev_week_period(start: date) -> tuple[date, date]:
|
||||
"""바로 앞 주차(앞 달 마지막 주차일 수 있다) — 회의록의 "지난주"."""
|
||||
return week_period(start - timedelta(days=1))
|
||||
|
||||
|
||||
def week_number(start: date) -> int:
|
||||
"""주차 시작일 → 그 달 몇 주차(1부터). 주차 시작일이 아니면 그 날짜가 든 주차."""
|
||||
return next(i + 1 for i, (a, b) in enumerate(month_weeks(start.year, start.month)) if a <= start <= b)
|
||||
|
||||
|
||||
def calendar_weeks(year: int, month: int) -> list[tuple[date, date]]:
|
||||
"""작은 달력용 — 그 달 날짜가 하나라도 든 주(월요일 시작) 전부(1일이 든 주부터 말일이 든 주까지)."""
|
||||
"""작은 달력용 — 그 달 날짜가 하나라도 든 줄(월요일 시작) 전부(1일이 든 줄부터 말일이 든 줄까지)."""
|
||||
first, last = date(year, month, 1), month_last_day(year, month)
|
||||
out, mon = [], week_monday(first)
|
||||
while mon <= last:
|
||||
@@ -686,17 +714,24 @@ def calendar_weeks(year: int, month: int) -> list[tuple[date, date]]:
|
||||
|
||||
|
||||
def validate_week_start(v: Any) -> date:
|
||||
"""회의록 시작일(날짜) — 020 부터 월요일이 아닐 수 있다. 주차 시작일인지는 validate_period_start."""
|
||||
try:
|
||||
d = date.fromisoformat(str(v).strip()[:10])
|
||||
except ValueError:
|
||||
raise ValueError("주 시작일이 올바르지 않습니다.")
|
||||
if d.weekday() != 0:
|
||||
raise ValueError("주 시작일은 월요일이어야 합니다.")
|
||||
if not 2000 <= d.year <= 2100:
|
||||
raise ValueError("주 시작일이 올바르지 않습니다.")
|
||||
return d
|
||||
|
||||
|
||||
def validate_period_start(v: Any) -> date:
|
||||
"""주차 시작일만(month_weeks 의 시작일) — 새 회의록·주차별 목표."""
|
||||
d = validate_week_start(v)
|
||||
if week_period(d)[0] != d:
|
||||
raise ValueError("주차 시작일이 아닙니다. 새로고침해 주세요.")
|
||||
return d
|
||||
|
||||
|
||||
def _korean_amount(s: str) -> float:
|
||||
""""1억2천만"·"3천만"·"1.5억"·"120만"·"3천5백" → 숫자. 단위 없는 숫자는 그대로. 틀리면 ValueError."""
|
||||
def small(t: str) -> float: # 만 아래 자리 — 천·백·십
|
||||
|
||||
Reference in New Issue
Block a user