feat(라이브): 스케줄표 머리글 굵게·가운데·쇼핑몰 열, 달력 카드에 쇼핑몰 아이콘
- 스케줄표 머리글: 가운데 정렬, 굵게, 검정, 글자 12% 크게 - 스케줄표 첫 열 = 호스트 쇼핑몰(틱톡·쇼피) 아이콘 - 달력 카드 머리 왼쪽 위 사방 화살표 대신 쇼핑몰 작은 아이콘 - 아이콘 = 말레이시아 배송 로고에서 심볼만 잘라 만든 live-icon-tiktok.png, live-icon-shopee.png Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ function check(name, cond, extra) {
|
||||
if (u.pathname.startsWith("/static/")) {
|
||||
const f = path.join(ROOT, "app", u.pathname);
|
||||
if (!fs.existsSync(f)) return r.fulfill({ status: 404, body: "" });
|
||||
const type = f.endsWith(".css") ? "text/css" : f.endsWith(".js") ? "application/javascript" : "font/woff2";
|
||||
const type = f.endsWith(".css") ? "text/css" : f.endsWith(".js") ? "application/javascript" : f.endsWith(".png") ? "image/png" : "font/woff2";
|
||||
return r.fulfill({ status: 200, contentType: type, body: fs.readFileSync(f) });
|
||||
}
|
||||
if (u.pathname.startsWith("/live/images/")) { // 결과 이미지 미리보기 — 아무 그림이나
|
||||
@@ -191,6 +191,16 @@ function check(name, cond, extra) {
|
||||
const text = await p.locator("#lv-side-cal").innerText();
|
||||
check("영문 화면 = 달력도 영어", !/[가-힣]/.test(text) && text.includes("November 2026") && text.includes("Sun") && text.includes("Replacement"), text);
|
||||
check("영문 말풍선", (await day("2026-11-09").getAttribute("title")) === "Deepavali (Replacement)");
|
||||
// 스케줄표 — 머리글 가운데·굵게·검정·12px × 1.12, 첫 열 = 쇼핑몰 아이콘
|
||||
await p.goto("http://erp.test/live_table_en.html");
|
||||
await p.waitForTimeout(300);
|
||||
const head = await p.evaluate(function () {
|
||||
const ths = Array.from(document.querySelectorAll(".lv-sched thead th")), c = getComputedStyle(ths[5]); // 5 = 금액 열(전엔 오른쪽 정렬)
|
||||
const img = document.querySelector(".lv-sched tbody tr td img.lv-pf");
|
||||
return [ths[0].textContent, c.textAlign, c.fontWeight, c.color, c.fontSize, img && img.naturalWidth, img && img.alt].join("|");
|
||||
});
|
||||
check("스케줄표 머리글·쇼핑몰 열", head === "Platform|center|700|rgb(0, 0, 0)|13.44px|64|TikTok", head);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_table.png") });
|
||||
// 방송 창이 애니메이션으로 나타남(추가·고치기 같은 창), 움직임 줄이기 설정이면 없음
|
||||
await p.goto("http://erp.test/live/calendar?month=2026-11");
|
||||
await p.waitForTimeout(200);
|
||||
@@ -204,6 +214,12 @@ function check(name, cond, extra) {
|
||||
await p.locator("#lv-dlg [data-close]").click();
|
||||
await p.locator(".lv-card-edit").first().click();
|
||||
check("고치기 창 애니메이션", (await anim()) === "lv-dlg-in|0.2s", await anim());
|
||||
// 카드 머리 왼쪽 = 호스트 쇼핑몰 아이콘(예전 ✥ 없음), 쇼핑몰 없는 호스트 = 아이콘 없음
|
||||
const pf = await p.evaluate(function () {
|
||||
const icon = function (id) { const i = document.querySelector('[data-card="' + id + '"] .lv-card-pf'); return i ? i.getAttribute("src").split("/").pop() + ":" + i.naturalWidth + ":" + Math.round(i.getBoundingClientRect().width) : "-"; };
|
||||
return [icon(6), icon(8), icon(22), document.body.textContent.indexOf("✥") < 0].join("|");
|
||||
});
|
||||
check("카드 쇼핑몰 아이콘", pf === "live-icon-tiktok.png:64:12|live-icon-shopee.png:64:12|-|true", pf);
|
||||
// Fee(시간 × 25)·커미션(판매금액 10%) 자동, 광고비·호스트 비용 = 저장한 값, 방송 장소 없음(2026-11-06)
|
||||
const fees = function () { return p.locator("#lv-dlg").evaluate(function (d) {
|
||||
const q = function (s) { return d.querySelector(s).value; };
|
||||
|
||||
@@ -35,10 +35,10 @@ class Fake:
|
||||
if start.month != 11:
|
||||
return []
|
||||
# 운영 화면처럼 — 6·8·16시 칸에 카드(세 줄 모두 카드가 있으면 그 줄이 가장 높다), 모든 시간 칸을 채워 높이 최악으로
|
||||
return [{"id": h, "host_id": 1, "host_name": "Nabella", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(h),
|
||||
return [{"id": h, "host_id": 1, "host_name": "Nabella", "host_platform": "tiktok" if h != 8 else "shopee", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(h),
|
||||
"end_time": time(h + 2), "venue": "", "sales_amount": Decimal("500"), "ad_spend": Decimal("100"), "host_fee": Decimal("50"),
|
||||
"images": [{"id": 7, "filename": "r.png"}, {"id": 8, "filename": "s.png"}] if h == 6 else []} for h in range(6, 24, 2) if h < 22] + \
|
||||
[{"id": 22, "host_id": 1, "host_name": "Nabella", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(22),
|
||||
[{"id": 22, "host_id": 1, "host_name": "Nabella", "host_platform": "", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(22),
|
||||
"end_time": time(23, 30), "venue": "", "sales_amount": Decimal("500"), "ad_spend": None, "host_fee": None, "images": []}]
|
||||
|
||||
def broadcast_days(self, start, end):
|
||||
@@ -54,10 +54,11 @@ def main_() -> None:
|
||||
user = {"email": "t@test.local", "name": "T", "role": "user", "is_super_admin": False, "modules": {"live": True}}
|
||||
with patch.object(main, "get_current_user_record", side_effect=lambda r: user), patch.object(main, "get_session_user", side_effect=lambda r: user), \
|
||||
patch.object(main.user_store, "get", side_effect=lambda e: user), patch.object(main.user_store, "list_all", side_effect=lambda: [user]):
|
||||
for name, lang, month in (("live_cal_ko.html", "ko", "2026-11"), ("live_cal_en.html", "en", "2026-11"), ("live_cal_dec.html", "ko", "2026-12")):
|
||||
for name, lang, url in (("live_cal_ko.html", "ko", "/live/calendar?month=2026-11"), ("live_cal_en.html", "en", "/live/calendar?month=2026-11"),
|
||||
("live_cal_dec.html", "ko", "/live/calendar?month=2026-12"), ("live_table_en.html", "en", "/live/?month=2026-11")):
|
||||
client = TestClient(main.app)
|
||||
client.cookies.set("live_lang", lang)
|
||||
res = client.get("/live/calendar?month=" + month)
|
||||
res = client.get(url)
|
||||
assert res.status_code == 200, (name, res.status_code)
|
||||
with open(os.path.join(OUT_DIR, name), "w", encoding="utf-8") as f:
|
||||
f.write(res.text)
|
||||
|
||||
+4
-2
@@ -81,11 +81,12 @@ class StoreTests(unittest.TestCase):
|
||||
|
||||
def test_edit_keeps_broadcast_account(self):
|
||||
"""고치기 창에 계정이 채워져야 저장하면서 지워지지 않는다."""
|
||||
view = store.broadcast_view({"id": 1, "host_id": 2, "host_name": "Yaya", "tiktok_handle": "alt.acc", "broadcast_date": date(2026, 11, 4),
|
||||
view = store.broadcast_view({"id": 1, "host_id": 2, "host_name": "Yaya", "host_platform": "shopee", "tiktok_handle": "alt.acc", "broadcast_date": date(2026, 11, 4),
|
||||
"start_time": time(20, 0), "end_time": time(22, 0), "venue": "", "sales_amount": None, "ad_spend": None,
|
||||
"host_fee": Decimal("40"), "images": []})
|
||||
self.assertEqual((view["edit"]["sales_amount"], view["edit"]["ad_spend"], view["edit"]["host_fee"], view["base"]), ("", "", "40.00", "50.00"))
|
||||
self.assertNotIn("venue", view["edit"]) # 방송 장소는 창에서 뺌(2026-11-06)
|
||||
self.assertEqual(view["platform"], "shopee") # 표 첫 열·카드 머리 아이콘
|
||||
self.assertEqual((view["tiktok_handle"], view["edit"]["tiktok_handle"], view["label"]), ("alt.acc", "alt.acc", "Yaya")) # 카드 머리 = 호스트, 계정은 아래
|
||||
|
||||
def test_my_holidays(self):
|
||||
@@ -170,7 +171,7 @@ class StoreTests(unittest.TestCase):
|
||||
|
||||
def test_build_calendar(self):
|
||||
def b(id, day, start, end, sales=None, host=1, handle="yaya", ad=None, fee=None):
|
||||
return {"id": id, "host_id": host, "host_name": "Yaya", "tiktok_handle": handle, "broadcast_date": day, "start_time": start,
|
||||
return {"id": id, "host_id": host, "host_name": "Yaya", "host_platform": "tiktok", "tiktok_handle": handle, "broadcast_date": day, "start_time": start,
|
||||
"end_time": end, "venue": "", "sales_amount": sales, "ad_spend": ad, "host_fee": fee, "images": []}
|
||||
span = store.month_range("2026-11", date(2026, 11, 4))
|
||||
cal = store.build_calendar(span, [b(1, date(2026, 11, 4), time(12, 0), time(14, 0), Decimal("48"), ad=Decimal("20"), fee=Decimal("54.8")),
|
||||
@@ -593,6 +594,7 @@ def body(c):
|
||||
assert r.json()["ok"], r.text
|
||||
page = c.get("/live/?month=2031-03").text
|
||||
assert "2031.03.05(수)" in page and "20:00 ~ 22:30" in page and "1,234.50" in page and 'name="venue"' not in page
|
||||
assert '<img class="lv-pf" src="/static/live-icon-tiktok.png" alt="TikTok"' in page # 첫 열 = 호스트 쇼핑몰 아이콘
|
||||
assert ">62.50</td>" in page and ">123.45</td>" in page and ">30.00</td>" in page and ">77.70</td>" in page # Fee 2.5시간 × 25·커미션 10%·광고비·호스트 비용(수기)
|
||||
assert "1,234.50" not in c.get("/live/?month=2031-04").text
|
||||
row = st.list_broadcasts(__import__("datetime").date(2031, 3, 1), __import__("datetime").date(2031, 4, 1))
|
||||
|
||||
Reference in New Issue
Block a user