feat(performance): KPI 수수료 차감 매출 한 줄·기본 보기 차감 매출·다음 업데이트 카운트다운·일 합계 ROAS
- KPI 는 수수료 차감 매출만 화면 왼쪽 한 줄(금액 + 비교 기간 대비 %), 나머지 카드 제거 - 일자별 표 기본 보기 = 수수료 차감 매출(localStorage 저장값 안 씀) - 마지막 업데이트 옆 다음 자동 업데이트까지 남은 시간(초 단위 실시간) - 일 합계 ROAS = 일 합계 금액 ÷ 일 합계 광고비(보기 기준별 roas / roas_net) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -116,7 +116,7 @@ def dashboard_page(
|
||||
from_: str | None = Query(None, alias="from"),
|
||||
to: str | None = None,
|
||||
m: list[str] = Query(default=[]),
|
||||
metric: str = "gross",
|
||||
metric: str = "net",
|
||||
):
|
||||
from app.main import render_template # noqa: WPS433
|
||||
|
||||
@@ -134,11 +134,27 @@ def dashboard_page(
|
||||
custom_from=_parse_date(from_), custom_to=_parse_date(to), selected=m,
|
||||
holidays=_holidays(), configured=creds.configured_codes(list(all_adapters())),
|
||||
)
|
||||
ctx["metric"] = metric if metric in ("gross", "commission", "net") else "gross"
|
||||
ctx["metric"] = metric if metric in ("gross", "commission", "net") else "net"
|
||||
ctx["auto_sync"] = _auto_sync_ctx()
|
||||
_unit_ctx(request, ctx)
|
||||
return render_template(request, "performance/index.html", {**common.base_ctx(user, active_tab="dashboard"), **ctx})
|
||||
|
||||
|
||||
def _auto_sync_ctx() -> dict[str, Any] | None:
|
||||
"""다음 자동 업데이트까지 남은 시간(2026-10-19) — 화면이 초 단위로 센다. 회차가 지나면 화면이 같은 규칙
|
||||
(hours·slot, KST)으로 다음 회차를 계산한다. 서버 시각(now)으로 PC 시계 차이를 보정. 자동 업데이트가 꺼져 있으면 None."""
|
||||
from app.timezone import now_kst # noqa: WPS433
|
||||
|
||||
from . import auto_sync # noqa: WPS433
|
||||
|
||||
if not auto_sync.enabled():
|
||||
return None
|
||||
hours = auto_sync.hour_window()
|
||||
now = now_kst()
|
||||
return {"next_at": auto_sync.next_slot(now, hours).isoformat(), "now": now.isoformat(timespec="milliseconds"),
|
||||
"hours": list(hours), "slot": auto_sync.SLOT_MINUTES}
|
||||
|
||||
|
||||
def _unit_ctx(request: Request, ctx: dict[str, Any]) -> None:
|
||||
"""매출 단위(원·천원·백만원) — 실적 설정 "보기 설정"이 이 브라우저 쿠키(perf_unit)에 둔다. 템플릿은 amt(v) 로 그린다."""
|
||||
from .dashboard import UNIT_COOKIE, UNITS, amount_text, normalize_unit # noqa: WPS433
|
||||
|
||||
Reference in New Issue
Block a user