feat(실적): 매출 실적 표에 카페24(공구 제외) 열 추가
- "카페24 공동구매" 열 바로 오른쪽에 카페24 − 카페24 공동구매 계산 열 (총매출·수수료·차감 매출 각각, 기간·주간 합계 행 포함) - 표 열만 — 일 합계·KPI·그래프엔 안 더함, 클릭·메모 없음 - 공동구매 쇼핑몰은 이름으로 찾음, 그룹 하위면 같은 그룹으로 접힘 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,3 +221,35 @@ def test_dashboard_page_renders_group_header_and_child_cells(client):
|
||||
body = html.split("<tbody>", 1)[1].split("</tbody>", 1)[0]
|
||||
assert 'data-group-cell="group_x"' in body and "150,000" in body
|
||||
assert 'data-group-child="group_x" data-manual-code="custom_a" data-date="2026-10-05"' in body
|
||||
|
||||
|
||||
def test_cafe24_minus_groupbuy_column():
|
||||
"""'카페24 공동구매' 바로 오른쪽 = 카페24 − 공동구매(2026-10-30). 표 열만 — 일 합계엔 안 더함."""
|
||||
st = _Store()
|
||||
st._find("custom_c")["name"] = "카페24 공동구매"
|
||||
st.manual[(date(2026, 10, 5), "custom_c")] = 300_000
|
||||
ctx = dashboard.build_dashboard(st, kind="week", anchor=TODAY, today=TODAY)
|
||||
assert [c["code"] for c in ctx["cols"]][-2:] == ["custom_c", dashboard.CAFE24_EX_GB]
|
||||
day5 = next(r for r in ctx["table"] if r.get("date") == "2026-10-05")
|
||||
assert day5["cells"][dashboard.CAFE24_EX_GB] == {"gross": 700_000, "commission": 0, "net": 700_000}
|
||||
assert day5["total"]["gross"] == 1_450_000 # 카페24 + 매장 150,000 + 공동구매 300,000
|
||||
week = next(r for r in ctx["table"] if r["kind"] == "week")
|
||||
assert week["cells"][dashboard.CAFE24_EX_GB]["gross"] == 700_000
|
||||
|
||||
# 카페24 를 고르지 않으면 열 없음, 공동구매가 그룹 하위면 같은 그룹으로 접힘
|
||||
ctx = dashboard.build_dashboard(st, kind="week", anchor=TODAY, today=TODAY, selected=["custom_c"])
|
||||
assert dashboard.CAFE24_EX_GB not in [c["code"] for c in ctx["cols"]]
|
||||
st._find("custom_c")["parent_code"] = "group_x"
|
||||
ctx = dashboard.build_dashboard(st, kind="week", anchor=TODAY, today=TODAY)
|
||||
assert ctx["cols"][-1] == {"code": dashboard.CAFE24_EX_GB, "kind": "diff", "group": "group_x"}
|
||||
|
||||
|
||||
def test_dashboard_page_renders_cafe24_minus_groupbuy(client):
|
||||
client.store._find("custom_c")["name"] = "카페24 공동구매"
|
||||
client.store.manual[(date(2026, 10, 5), "custom_c")] = 300_000
|
||||
html = client.get("/performance/?period=week&d=2026-10-07").text
|
||||
head = html.split("<thead>", 1)[1].split("</thead>", 1)[0]
|
||||
assert head.index('data-col="custom_c"') < head.index(f'data-col="{dashboard.CAFE24_EX_GB}"')
|
||||
assert "카페24(공구 제외)" in head
|
||||
body = html.split("<tbody>", 1)[1].split("</tbody>", 1)[0]
|
||||
assert "700,000" in body
|
||||
|
||||
Reference in New Issue
Block a user