feat(라이브): 달력에서 방송이 걸친 시간 칸을 합쳐 표시
- 2시간 방송 = 두 칸(rowspan), 30분이라도 걸치면 그 칸까지, 자정 넘김은 그날 마지막 칸까지
- 합친 칸 안에서 시작하는 다른 방송도 같은 칸에 넣고 더 길면 칸을 늘림
- 직전 커밋 1babc39 의 메시지는 잘못 들어감 — 실제 내용은 달력 시간 칸 1시간 단위 변경
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,19 @@ function check(name, cond, extra) {
|
||||
await day("2026-11-02").click();
|
||||
await p.waitForTimeout(150);
|
||||
check("앞날로 돌아감", (await gap("2026-11-02")) < 2, await gap("2026-11-02"));
|
||||
// 2시간 방송 = 두 칸 합침(rowspan), 22:00~23:30 = 22·23 칸
|
||||
const merged = await p.evaluate(function () {
|
||||
return Array.from(document.querySelectorAll('td[data-day="2026-11-05"]')).map(function (td) { return td.dataset.start + "/" + (td.rowSpan || 1); });
|
||||
});
|
||||
check("2시간 방송 = 두 칸 합침", merged.slice(0, 3).join(",") === "06:00/2,08:00/2,10:00/2" && merged[merged.length - 1] === "22:00/2", merged);
|
||||
const tall = await p.evaluate(function () {
|
||||
const m = document.querySelector('td[data-day="2026-11-05"][data-start="06:00"]').getBoundingClientRect().height;
|
||||
const one = document.querySelector('td[data-day="2026-11-04"][data-start="06:00"]').getBoundingClientRect().height;
|
||||
const two = document.querySelector('td[data-day="2026-11-04"][data-start="07:00"]').getBoundingClientRect().height;
|
||||
return Math.abs(m - one - two);
|
||||
});
|
||||
check("합친 칸 높이 = 두 줄", tall < 2, tall);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_merge.png") });
|
||||
|
||||
await p.locator('#lv-side-cal [data-nav="1"]').click();
|
||||
await Promise.all([p.waitForURL(/month=2026-12/), day("2026-12-10").click()]);
|
||||
|
||||
+20
-2
@@ -192,8 +192,26 @@ class StoreTests(unittest.TestCase):
|
||||
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"], "03:00 - 04:00")
|
||||
self.assertEqual(len(early["slots"]), 19)
|
||||
self.assertEqual([s["label"] for s in early["slots"]][:3], ["03:00 - 04:00", "04:00 - 05:00", "06:00 - 07:00"]) # 걸친 칸은 늘 있음
|
||||
self.assertEqual(len(early["slots"]), 20)
|
||||
|
||||
# 칸 합치기(rowspan) — 방송이 걸친 시간만큼, 겹쳐 시작하는 방송은 같은 칸, 자정 넘김은 그날 끝까지
|
||||
def col(c, day_index):
|
||||
return [(s["start"], cell.get("rowspan"), [x["id"] for x in cell.get("cards", [])]) for s in c["slots"]
|
||||
for cell in [s["cells"][day_index]] if not cell.get("skip")]
|
||||
self.assertEqual(col(cal, 3)[6:9], [("12:00", 2, [1]), ("14:00", 1, []), ("15:00", 1, [])]) # 12~14 = 두 칸
|
||||
self.assertEqual(col(cal, 3)[-1], ("22:00", 2, [2])) # 22~00 = 22·23 칸
|
||||
self.assertEqual(col(cal, 6)[7], ("13:00", 2, [3])) # 13:30~15:00 = 13·14 칸
|
||||
self.assertEqual(sum(1 for s in cal["slots"] if s["cells"][3].get("skip")), 2)
|
||||
m = store.build_calendar(span, [b(5, date(2026, 11, 2), time(6, 0), time(8, 0)), b(6, date(2026, 11, 2), time(7, 0), time(10, 0)),
|
||||
b(7, date(2026, 11, 2), time(23, 0), time(1, 0)), b(8, date(2026, 11, 2), time(20, 0), time(20, 30))],
|
||||
{}, date(2026, 11, 4))
|
||||
self.assertEqual(col(m, 1)[0], ("06:00", 4, [5, 6])) # 6~8 + 7~10 = 6·7·8·9
|
||||
self.assertEqual(col(m, 1)[1][0], "10:00")
|
||||
self.assertIn(("20:00", 1, [8]), col(m, 1)) # 30분 = 한 칸
|
||||
self.assertEqual(col(m, 1)[-1], ("23:00", 1, [7])) # 자정 넘김 = 그날 마지막 칸까지
|
||||
for s in m["slots"]: # 날짜마다 칸 수(합친 칸 포함) = 줄 수
|
||||
self.assertEqual(len(s["cells"]), 30)
|
||||
|
||||
def test_thumbnail(self):
|
||||
for mode, fmt in (("RGB", "JPEG"), ("RGBA", "PNG")):
|
||||
|
||||
Reference in New Issue
Block a user