feat(performance): 기간 빠른 선택 이번달·올해만(기본 이번달) · 일자별 표 제목·기간 합계 행 스크롤 고정

- 매출 실적·광고비 탭 오늘·이번주 버튼 삭제, 매출 실적 기본 기간 = 이번달
- 일자별 표 상자(.perf-main-wrap)를 화면 높이로 묶어 상자 안 세로 스크롤 — 제목 행 + 맨 위 기간 합계 행 sticky
  (합계 행 top = 제목 행 높이 --perf-head-h, stickyHead 가 ResizeObserver 로 잼), 날짜 열 가로 고정은 그대로
- 테스트: perf_sticky.browser.test.js(실제 브라우저), test_ad_spend 빠른 선택 순서

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 12:29:09 +09:00
parent 7731e4e8de
commit 3d14ff4a85
12 changed files with 135 additions and 18 deletions
+5
View File
@@ -44,6 +44,11 @@
서버가 계산(원 반올림)해 금액으로, 식은 `formula` 열에 저장 → 칸 `is-formula` 파랑 굵은 숫자, 다시 누르면 식. 숫자 입력·업로드·광고 API 로 덮으면 식 지움(`db._set_formulas`, 008 미적용이면 조용히 건너뜀).
광고비 탭 직접 입력값은 파랑 **보통 굵기**(굵게는 계산식만), 매출 탭 수동 입력값은 예전처럼 파랑 굵게.
- 일자별 표 **기간 합계 행은 맨 위**(제목 행 바로 아래, 2026-10-21 `calc.main_table`) — 매출·광고비 공통, 연간 보기 "연간 합계"는 그대로 맨 아래.
- **기간 빠른 선택 = 이번달·올해·직접선택**(2026-10-26 — 오늘·이번주 버튼 삭제, `dashboard.build_dashboard`·`ad_spend.build_ad_dashboard` 의 `nav.quick`),
매출 실적 기본 기간도 **이번달**(`router.dashboard_page` `period="month"`, 광고비는 원래 이번달). day·week 주소(`?period=week`)는 그대로 열린다.
- **일자별 표 스크롤 고정**(2026-10-26, `.perf-main-wrap`) — 표 상자를 화면 높이(`100vh − 상단 바 − 24px`)로 묶어 상자 안에서 세로 스크롤,
제목 행 + 맨 위 기간 합계 행(`tbody tr.perf-row-total:first-child`)이 sticky. 합계 행 top = 제목 행 높이(`--perf-head-h`, `performance.js stickyHead`
가 ResizeObserver 로 잼). 상자가 가로 스크롤이라 페이지 스크롤 기준 sticky 는 안 먹어서 상자 안 스크롤로 했다. 테스트 `tests/js/perf_sticky.browser.test.js`.
- 열 순서 카페24·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰(마이그레이션 003).
- 쿠팡(로켓)·애터미아자몰은 **수동 입력 전용**(`adapters/manual.py`, `manual_only` — 매출 업데이트에서 빠지고 인증 설정·연결 테스트 없음, 수동 입력 늘 켜짐).
- **직접 추가 쇼핑몰·그룹·순서 드래그**(2026-10-22, 마이그레이션 009 `is_custom`·`is_group`·`parent_code`) — 설정 [+ 쇼핑몰 추가(수동 입력)]
+1 -2
View File
@@ -553,9 +553,8 @@ def build_ad_dashboard(store: Any, *, kind: str, anchor: date, today: date,
next_url = url("custom", start=period.end + timedelta(days=1), end=period.end + length)
else:
prev_url, next_url = url(period.kind, period.prev_anchor), url(period.kind, period.next_anchor)
# 빠른 선택은 이번달·올해만(2026-10-26 — 오늘·이번주 버튼 삭제, 매출 실적과 같게)
nav = {"prev": prev_url, "next": next_url, "quick": [
{"label": "오늘", "url": url("day", today), "active": period.kind == "day" and period.start == today},
{"label": "이번주", "url": url("week", today), "active": period.kind == "week" and period.start <= today <= period.end},
{"label": "이번달", "url": url("month", today), "active": period.kind == "month" and period.start <= today <= period.end},
{"label": "올해", "url": url("year", today), "active": period.kind == "year" and period.start <= today <= period.end},
]}
+1 -4
View File
@@ -249,11 +249,8 @@ def build_dashboard(store: Any, *, kind: str, anchor: date, today: date,
next_url = url(period.kind, period.next_anchor)
nav = {
"prev": prev_url, "next": next_url,
# 빠른 선택은 이번달·올해만(2026-10-26 — 오늘·이번주 버튼 삭제, 기본 = 이번달)
"quick": [
{"key": "day", "label": "오늘", "url": url("day", today),
"active": period.kind == "day" and period.start == today},
{"key": "week", "label": "이번주", "url": url("week", today),
"active": period.kind == "week" and period.start <= today <= period.end},
{"key": "month", "label": "이번달", "url": url("month", today),
"active": period.kind == "month" and period.start <= today <= period.end},
{"key": "year", "label": "올해", "url": url("year", today),
+1 -1
View File
@@ -121,7 +121,7 @@ def health(request: Request) -> JSONResponse:
@router.get("/", response_class=HTMLResponse)
def dashboard_page(
request: Request,
period: str = "week",
period: str = "month",
d: str | None = None,
from_: str | None = Query(None, alias="from"),
to: str | None = None,
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#}
{%- macro roas(p) -%}{%- if p is not none -%}<span class="perf-roas">({{ "{:,}".format(p) }}%)</span>{%- endif -%}{%- endmacro -%}
@@ -96,7 +96,8 @@
{% endif %}
</div>
</div>
<div class="erp-table-wrap perf-table-wrap">
<div class="erp-table-wrap perf-table-wrap perf-main-wrap">
{#- perf-main-wrap(2026-10-26) = 표 안에서 세로 스크롤 — 제목 행·기간 합계 행 고정 -#}
{#- perf-autofit(2026-10-22) = 열 너비는 내용 길이만큼, 날짜 열은 가로 스크롤해도 고정(매출 실적 표와 같음) -#}
<table class="perf-table perf-main perf-autofit">
<thead>
@@ -240,4 +241,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{%- macro won(v) -%}
{%- if v is none -%}<span class="perf-na"></span>
@@ -134,7 +134,8 @@
<button type="button" class="perf-seg" data-metric="net">수수료 차감 매출</button>
</div>
</div>
<div class="erp-table-wrap perf-table-wrap">
<div class="erp-table-wrap perf-table-wrap perf-main-wrap">
{#- perf-main-wrap(2026-10-26) = 표 안에서 세로 스크롤 — 제목 행·기간 합계 행 고정 -#}
{#- perf-autofit(2026-10-22) = 열 너비는 내용 길이만큼, 날짜 열은 가로 스크롤해도 고정 -#}
<table class="perf-table perf-main perf-autofit">
<thead>
@@ -291,4 +292,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261022c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261026a" />{% endblock %}
{%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%}
@@ -259,4 +259,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022e" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261026a" defer></script>{% endblock %}
@@ -146,7 +146,7 @@ def test_ad_dashboard_month():
assert ctx["roas_basis"]["google"] == "" and ctx["roas_basis"]["coupang_wing"] == "쿠팡(윙)"
assert {r["code"]: r for r in ctx["month"]["rows"]}["google"]["roas"] is None
assert ads.roas(1, 3) == 33 and ads.roas(1, 200) == 1 and ads.roas(5, 0) is None # 0.5% 반올림 → 1
assert ctx["nav"]["quick"][2]["active"] # 이번달
assert ctx["nav"]["quick"][0]["active"] # 이번달
def test_ad_dashboard_year_and_missing_table():