fix(project): 회의록 쇼핑몰 연결 결과 — 진행 전 주·실적 미사용 쇼핑몰을 0 대신 구분, 이번주 실적 표시
- 지난 회의록 주가 아직 시작 전이면 자동 0 대신 "진행 전" - 실적 모듈에서 사용 중이 아닌 쇼핑몰(사용 OFF·없는 코드)에 연결된 줄은 "실적 미사용" 표시 + 결과 직접 입력 - 자동 결과 말풍선에 쇼핑몰·기간, 0 이면 매출 업데이트 안내 - 쇼핑몰 연결 줄의 목표 금액 아래에 이번주 실적(월요일~오늘, 목표 대비 %) - project.css/js 캐시 버전 20261001d, 문서 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2868,26 +2868,40 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat
|
||||
}
|
||||
if meeting:
|
||||
# 줄마다 전주 결과 — 쇼핑몰 연결이면 그 주 실적(자동), 아니면 직접 입력한 결과
|
||||
all_codes = [m["code"] for m in markets]
|
||||
by_week: dict[str, dict[str, int] | None] = {}
|
||||
|
||||
def week_sales(ws: str) -> dict[str, int] | None:
|
||||
"""그 주(월~일, 오늘까지) 쇼핑몰별 실적 — 아직 시작 안 한 주는 None."""
|
||||
if ws not in by_week:
|
||||
a = date.fromisoformat(ws)
|
||||
by_week[ws] = _perf_sum(perf, a, min(a + timedelta(days=6), today), all_codes) if a <= today else None
|
||||
return by_week[ws]
|
||||
|
||||
for it in meeting["items"]:
|
||||
prev = it.get("prev")
|
||||
if not prev:
|
||||
continue
|
||||
auto = None
|
||||
code = prev.get("marketplace_code") or ""
|
||||
if code:
|
||||
ws = prev["week_start"]
|
||||
if ws not in by_week:
|
||||
a = date.fromisoformat(ws)
|
||||
by_week[ws] = _perf_sum(perf, a, min(a + timedelta(days=6), today),
|
||||
[m["code"] for m in markets]) if a <= today else {}
|
||||
got = by_week[ws]
|
||||
a = date.fromisoformat(prev["week_start"])
|
||||
prev["period"] = f"{a.month}/{a.day}~{(a + timedelta(days=6)).month}/{(a + timedelta(days=6)).day}"
|
||||
prev["not_started"] = bool(code) and a > today
|
||||
# 실적 모듈에서 사용 중이 아닌 쇼핑몰(설정에서 사용 OFF·없는 코드)은 늘 0 이라 자동으로 보지 않고 직접 입력
|
||||
prev["market_off"] = bool(code) and code not in names
|
||||
if code and perf is not None and not prev["not_started"] and not prev["market_off"]:
|
||||
got = week_sales(prev["week_start"])
|
||||
auto = None if got is None else got.get(code, 0)
|
||||
prev["auto_result"] = auto
|
||||
prev["result"] = auto if auto is not None else prev.get("result_amount")
|
||||
prev["market_name"] = names.get(code, code)
|
||||
for it in meeting["items"]:
|
||||
it["market_name"] = names.get(it["marketplace_code"], it["marketplace_code"]) if it["marketplace_code"] else ""
|
||||
code = it["marketplace_code"]
|
||||
it["market_name"] = names.get(code, code) if code else ""
|
||||
it["market_off"] = bool(code) and code not in names
|
||||
# 이번 주 진행 중 실적(쇼핑몰 연결 줄) — 목표 금액 칸 아래에 "이번주 실적"
|
||||
got = week_sales(meeting["week_start"]) if code and perf is not None and not it["market_off"] else None
|
||||
it["week_auto"] = None if got is None else got.get(code, 0)
|
||||
p = it.get("prev")
|
||||
it["rate"] = (round(p["result"] / p["target_amount"] * 100, 1)
|
||||
if p and p.get("result") is not None and p.get("target_amount") else None)
|
||||
|
||||
Reference in New Issue
Block a user