feat(라이브커머스): 한글·영문 전환 버튼과 메인 카드 제목 표기

스케줄표·달력·호스트 설정 위에 한글/EN 버튼을 두고 화면·창·오류·확인
문구를 모두 전환한다(쿠키 live_lang, 브라우저마다 기억). 메인 카드 제목은
"라이브 커머스 · Live Commerce"로 표기한다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 10:51:06 +09:00
parent 387341b1d8
commit 1babc39b64
8 changed files with 31 additions and 22 deletions
+11 -11
View File
@@ -171,12 +171,12 @@ class StoreTests(unittest.TestCase):
b(3, date(2026, 11, 7), time(13, 30), time(15, 0))],
{date(2026, 11, 4): Decimal("24")}, date(2026, 11, 4), "en")
ko = store.build_calendar(span, [], {}, date(2026, 11, 4))
self.assertEqual((ko["days"][3]["weekday"], ko["days"][3]["label"], ko["slot_note"]), ("수요일", "11월 4일", "2시간 (기본 RM50)"))
self.assertEqual((ko["days"][3]["weekday"], ko["days"][3]["label"], ko["slot_note"]), ("수요일", "11월 4일", "1시간 (기본 RM25)"))
self.assertEqual(len(cal["days"]), 30)
self.assertEqual([s["label"] for s in cal["slots"]][0], "06:00 - 08:00")
self.assertEqual([s["label"] for s in cal["slots"]][-1], "22:00 - 00:00")
self.assertEqual(len(cal["slots"]), 9)
self.assertEqual(cal["slot_note"], "2 Hours (RM50 Base)")
self.assertEqual([s["label"] for s in cal["slots"]][0], "06:00 - 07:00")
self.assertEqual([s["label"] for s in cal["slots"]][-1], "23:00 - 00:00")
self.assertEqual(len(cal["slots"]), 18)
self.assertEqual(cal["slot_note"], "1 Hour (RM25 Base)")
d4 = cal["days"][3]
self.assertEqual((d4["weekday"], d4["label"], d4["count"], d4["is_today"], d4["is_weekend"]), ("WEDNESDAY", "4 NOV", 2, True, False))
self.assertEqual((d4["sales_text"], d4["spend_text"], d4["fee_text"], d4["roas"]), ("48", "24", "104.80", "2.00"))
@@ -187,13 +187,13 @@ class StoreTests(unittest.TestCase):
self.assertEqual((noon["cells"][3]["cards"][0]["card_sales"], noon["cells"][3]["cards"][0]["card_commission"], noon["cells"][3]["cards"][0]["card_fee"]),
("48", "4.80", "54.80"))
late = next(s for s in cal["slots"] if s["start"] == "22:00")
self.assertEqual((late["end"], late["cells"][3]["cards"][0]["label"]), ("00:00", "Yaya")) # 핸들 없으면 이름
self.assertEqual(next(s for s in cal["slots"] if s["start"] == "12:00")["cells"][6]["cards"][0]["id"], 3) # 13:30 = 12~14 칸
self.assertEqual((late["end"], late["cells"][3]["cards"][0]["label"]), ("23:00", "Yaya")) # 핸들 없으면 이름
self.assertEqual(next(s for s in cal["slots"] if s["start"] == "13:00")["cells"][6]["cards"][0]["id"], 3) # 13:30 = 13~14 칸
self.assertEqual(cal["totals"]["sales"], "48")
# 06시보다 이른 칸은 방송이 있을 때만
early = store.build_calendar(span, [b(9, date(2026, 11, 1), time(3, 0), time(5, 0))], {}, date(2026, 11, 4))
self.assertEqual(early["slots"][0]["label"], "02:00 - 04:00")
self.assertEqual(len(early["slots"]), 10)
self.assertEqual(early["slots"][0]["label"], "03:00 - 04:00")
self.assertEqual(len(early["slots"]), 19)
def test_thumbnail(self):
for mode, fmt in (("RGB", "JPEG"), ("RGBA", "PNG")):
@@ -532,7 +532,7 @@ def body(c):
# ── 달력: 카드 머리 = Tiktok Handle, Fee, 옮기기(길이 유지)·맞바꾸기, 광고비·ROAS, 권한 ──
c.post("/live/broadcasts", data={**show, "id": bid, "sales_amount": "48", "start_time": "12:00", "end_time": "14:00", "broadcast_date": "2031-03-05"})
cal = c.get("/live/calendar?month=2031-03").text
assert "날짜로 이동" not in cal and "토요일" in cal and "12:00 - 14:00" in cal and "2시간 (기본 RM50)" in cal
assert "날짜로 이동" not in cal and "토요일" in cal and "12:00 - 13:00" in cal and "1시간 (기본 RM25)" in cal
assert '"2031-03-05"' in cal.split('id="lv-live-days">')[1].split("</script>")[0] # 오른쪽 달력 점
assert '<span class="lv-card-name">S%s<small>@siti.%s</small></span>' % (tag, tag) in cal and "RM54.80" in cal and ">4.80</b>" in cal
@@ -548,7 +548,7 @@ def body(c):
page = no_korean("/live/?month=2031-03")
assert 'lang="en"' in page and "March 2031" in page and "2031.03.05 (Wed)" in page and "Commission 10% (RM)" in page
cal = no_korean("/live/calendar?month=2031-03")
assert "SATURDAY" in cal and "1 MAR" in cal and "2 Hours (RM50 Base)" in cal and ">Sales<" in cal and "Com (10%)" in cal and "Fee: <b>RM54.80" in cal
assert "SATURDAY" in cal and "1 MAR" in cal and "1 Hour (RM25 Base)" in cal and ">Sales<" in cal and "Com (10%)" in cal and "Fee: <b>RM54.80" in cal
assert "Total Sales:" in cal and "Ad Spend:" in cal and "Host Fee:" in cal and "Total &amp; ROAS" in cal
assert c.post("/live/broadcasts", data={**show, "id": bid, "sales_amount": "abc"}).json()["message"] == "Sales must be a number."
assert c.post("/live/broadcasts", data={**show, "id": bid, "end_time": ""}).json()["message"] == "Enter the End Time."