feat(실적): 카페24(실적) 열·합계 기준 통일·공통 보기 설정·일 합계 고정
매출 실적 - "카페24" 열 → "카페24(전체)", 바로 오른쪽 "카페24(실적)" = 전체 − 자사몰(공동구매), 광고비 줄은 카페24(전체)의 구글·메타 그대로 (예전 "공구 제외" 열 대체) - 합계 기준 통일: 일 합계·ROAS·KPI·추이·비중·월/연 누적 = 카페24(실적) + 공동구매 + 나머지 (카페24(전체)에 공동구매가 들어 있어 이중 합산 제거, 그래프·누적의 카페24 줄 = 카페24(실적)) - 실적 설정 "공통 보기 설정"(관리자, perf_settings, 모든 사용자 적용): 매출 단위(예전 브라우저 쿠키 perf_unit 대체), 표 열 숨기기(열만, 합계 그대로) 표 열 너비는 사람(브라우저)마다 그대로 매출 실적·광고비 공통 - 일 합계 열을 날짜 오른쪽으로, 날짜와 함께 가로 고정 - 이전달·다음달 = 날짜 바로 옆 진한 회색 화살표 SVG(글자 높이) - 광고비 탭 매출 대비 광고비·합계 ROAS 도 공동구매 이중 합산 제거 CSS·JS 캐시 버전 20261102a. 새 마이그레이션 없음(011 perf_settings 사용). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,15 +121,51 @@ def test_dashboard_page_renders_unit_and_ad_lines(monkeypatch):
|
||||
assert 'class="perf-adl"' in html and "<i>구글</i>100,000<em>(413%)</em>" in html and "<i>메타</i>50,000" in html
|
||||
assert "200,000<em>(300%)</em>" in html and "단위:" not in html
|
||||
|
||||
client.cookies.set("perf_unit", "thousand")
|
||||
# 매출 단위 = 서버 공통 설정(2026-11-02) — 예전 브라우저 쿠키는 안 봄
|
||||
client.cookies.set("perf_unit", "million")
|
||||
assert "단위:" not in client.get("/performance/?period=week&d=2026-10-07").text
|
||||
client.cookies.delete("perf_unit")
|
||||
store.get_setting = lambda key: "thousand" if key == dashboard.UNIT_SETTING else None
|
||||
html = client.get("/performance/?period=week&d=2026-10-07").text
|
||||
assert "단위: 천원" in html and "2,000<" in html and "<i>구글</i>100<em>(413%)</em>" in html
|
||||
assert "2,000,000<" not in html.split("perf-main", 1)[1].split("</table>", 1)[0]
|
||||
client.cookies.set("perf_unit", "million")
|
||||
store.get_setting = lambda key: "million" if key == dashboard.UNIT_SETTING else None
|
||||
html = client.get("/performance/?period=week&d=2026-10-07").text
|
||||
assert "단위: 백만원" in html and ">2.0<" in html and '"unit": "million"' in html
|
||||
|
||||
|
||||
def test_api_display_unit(monkeypatch):
|
||||
import importlib
|
||||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.modules.performance import common
|
||||
|
||||
perf_router = importlib.import_module("app.modules.performance.router")
|
||||
saved = {}
|
||||
store = _Store()
|
||||
store.set_setting = lambda key, value, *, user="": saved.__setitem__(key, (value, user))
|
||||
monkeypatch.setattr(common, "require_store", lambda request, admin=False: (store, {"email": "king@x"}))
|
||||
app = FastAPI()
|
||||
app.include_router(perf_router.router)
|
||||
client = TestClient(app)
|
||||
|
||||
assert client.put("/performance/api/display-unit", json={"unit": "thousand"}).json()["unit"] == "thousand"
|
||||
assert saved[dashboard.UNIT_SETTING] == ("thousand", "king@x")
|
||||
assert client.put("/performance/api/display-unit", json={"unit": "nope"}).status_code == 400
|
||||
assert client.put("/performance/api/display-unit", json={"unit": ["won"]}).status_code == 400
|
||||
|
||||
def not_admin(request, admin=False):
|
||||
if admin:
|
||||
raise HTTPException(status_code=403)
|
||||
return store, {"email": "u@x"}
|
||||
|
||||
monkeypatch.setattr(common, "require_store", not_admin)
|
||||
assert client.put("/performance/api/display-unit", json={"unit": "won"}).status_code == 403
|
||||
assert saved[dashboard.UNIT_SETTING] == ("thousand", "king@x")
|
||||
|
||||
|
||||
def test_total_roas_uses_whole_day_total():
|
||||
"""일 합계 ROAS = 그날 일 합계 금액(광고비 없는 쇼핑몰 매출 포함) ÷ 일 합계 광고비 — 예전엔 광고비 있는 쇼핑몰 매출만 더했다."""
|
||||
class _S(_Store):
|
||||
|
||||
Reference in New Issue
Block a user