feat(performance): 자동 업데이트가 끝나면 매출 실적·광고비 화면 새로 고침
- 화면이 20초마다 GET /api/update-status?kind=sales|ads 로 마지막으로 끝난 업데이트를 보고, 그린 때(update_watch.seen)와 다르고 도는 중이 아니면 reload (jobs.last_finished — 메모리만, DB 안 읽음) - 보는 사람이 직접 누른 업데이트는 제외(진행 창이 새로 그림), 매출·광고비 따로 - 칸 입력·창·메뉴·확인 창이 열려 있으면 닫힐 때까지 기다리고 "새 데이터 있음" 안내, 탭이 안 보이면 안 물음 - 테스트: last_finished·update-status API, 브라우저(새로 고침·기다림·종류별) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,8 @@ def main() -> None:
|
||||
ctx["auto_sync"] = {"next_at": "2026-10-07T10:30:00+09:00", "now": "2026-10-07T10:17:25.000+09:00",
|
||||
"schedule": {"enabled": True, "interval": 30, "days": [0, 1, 2, 3, 4, 5, 6], "start": "09:00", "end": "19:00"},
|
||||
"label": "매일 09:00~19:00 · 30분마다"}
|
||||
# 화면 자동 새로 고침(2026-10-26, router._update_watch) — 그린 때 마지막으로 끝난 업데이트
|
||||
ctx["update_watch"] = {"kind": "sales", "seen": "job-old"}
|
||||
html = e.get_template("performance/index.html").render(**base, active_tab="dashboard", metric="net", **ctx)
|
||||
with open(os.path.join(OUT_DIR, "perf_dash.html"), "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
@@ -104,12 +106,14 @@ def main() -> None:
|
||||
sbase = {**base, "user": {"email": "me@test.local", "name": "Me", "picture": ""}}
|
||||
mctx = build_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7))
|
||||
mctx["auto_sync"] = ctx["auto_sync"]
|
||||
mctx["update_watch"] = {"kind": "sales", "seen": "job-old"}
|
||||
html = shell.get_template("performance/index.html").render(**sbase, active_tab="dashboard", metric="net", **mctx)
|
||||
with open(os.path.join(OUT_DIR, "perf_dash_shell.html"), "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
sactx = build_ad_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7),
|
||||
sales_codes=["cafe24", "coupang"])
|
||||
sactx["auto_sync"] = ctx["auto_sync"]
|
||||
sactx["update_watch"] = {"kind": "ads", "seen": "job-old"}
|
||||
html = shell.get_template("performance/ads.html").render(**sbase, active_tab="ads", **sactx)
|
||||
with open(os.path.join(OUT_DIR, "perf_ads_shell.html"), "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
@@ -117,6 +121,7 @@ def main() -> None:
|
||||
sales_codes=["cafe24", "coupang"])
|
||||
actx["ad_sync_sources"] = [{"code": "google", "name": "구글 광고"}] # [구글 광고 불러오기]
|
||||
actx["auto_sync"] = ctx["auto_sync"] # 광고비 탭도 다음 업데이트 카운트다운(router._auto_sync_ctx)
|
||||
actx["update_watch"] = {"kind": "ads", "seen": "job-old"}
|
||||
html = e.get_template("performance/ads.html").render(**base, active_tab="ads", **actx)
|
||||
with open(os.path.join(OUT_DIR, "perf_ads.html"), "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
@@ -136,6 +141,7 @@ def main() -> None:
|
||||
# 직접 추가 쇼핑몰·그룹(2026-10-22) — perf_dash_groups.html · perf_settings_groups.html (perf_groups.browser.test.js)
|
||||
gctx = build_dashboard(GroupStore(), kind="week", anchor=date(2026, 10, 7), today=date(2026, 10, 7))
|
||||
gctx["auto_sync"] = None
|
||||
gctx["update_watch"] = None
|
||||
html = e.get_template("performance/index.html").render(**base, active_tab="dashboard", metric="gross", **gctx)
|
||||
with open(os.path.join(OUT_DIR, "perf_dash_groups.html"), "w", encoding="utf-8") as f:
|
||||
f.write(html)
|
||||
|
||||
Reference in New Issue
Block a user