Compare commits
2 Commits
828ba0938a
...
ab6c243ab7
| Author | SHA1 | Date | |
|---|---|---|---|
| ab6c243ab7 | |||
| fc95c8bd25 |
@@ -15,11 +15,12 @@
|
||||
사용 안 함 = 새 방송에서 못 고름(그 호스트로 이미 등록된 방송을 고칠 때만 보임). 방송 기록이 있는 호스트는 못 지움(FK RESTRICT).
|
||||
- **스케줄표** `/live/?month=YYYY-MM`(`live` 권한자 모두) — 호스트·날짜·시작/끝 시간·판매금액·시간 요금(Fee)·커미션·광고비·호스트 비용·결과 이미지. 호스트·날짜·시작·끝 시간 필수(판매금액은 방송 후 입력).
|
||||
시간은 입력한 말레이시아 시간 그대로(시간대 변환 없음, DATE·TIME). 금액 단위 RM(`NUMERIC(14,2)`, `store.parse_money(값, 이름)`). 끝 시간이 시작보다 이르면 자정을 넘긴 방송.
|
||||
표 첫 열 = 호스트 쇼핑몰 아이콘(`/static/live-icon-tiktok.png`·`live-icon-shopee.png` = 말레이시아 배송 로고에서 심볼만 잘라 64px, 쇼핑몰 안 고른 호스트는 빈칸), 머리글 = 가운데·굵게·검정·공용 크기 112%(`.lv-sched`, 스케줄표만).
|
||||
**방송 장소는 2026-11-06 에 창·표에서 뺌**(`venue` 열은 예전 값만 남고 저장 때 건드리지 않음, 달력 카드 말풍선에만 예전 값).
|
||||
- **방송 창 금액**(2026-11-06, 마이그레이션 006) — **Fee**(시간 × RM 25 `HOURLY_RATE`)·**커미션**(판매금액 × 10% `COMMISSION_PERCENT`) = 자동, 저장 안 함(`store.session_pay`, 창에서는 `live.js recalc` 가 같은 계산 — 시간·판매금액을 바꾸거나 결과 이미지에서 매출을 읽으면 다시 계산). 요율이 코드 상수라 바꾸면 지난 방송 값도 바뀐다.
|
||||
**광고비**(`live_broadcasts.ad_spend`)·**호스트 비용**(`host_fee`, 일단 수기 입력) = 입력·저장. 달력 카드 Fee·날짜/달 합계 호스트 비용 = `host_fee` 합(비우면 0).
|
||||
- **달력 보기** `/live/calendar?month=`(`store.build_calendar`, 사용자가 준 화면 참고, 글자도 영어 그대로) — 줄 = 1시간 칸(2026-11-06 `store.SLOT_HOURS` 2 → 1, 06:00~24:00 늘 보임, 그보다 이른 칸은 방송이 있을 때만, 칸은 시작 시간으로 정함), 열 = 날짜, 주말 노랑, 위 달 합계, 맨 아래 날짜별 TOTAL SALES·AD SPEND·HOST FEE·ROAS.
|
||||
카드 머리 = **Tiktok Handle**(없으면 이름, 색 = 호스트 id 순 `HOST_COLORS`), SALES·COM·Fee. 카드 머리를 끌어 빈 칸으로 = 옮기기(`move`, 방송 길이 유지) · 다른 카드 위 = 맞바꾸기(`swap_with`, 날짜·시간 교환). 다시 그린 뒤 가로 위치 유지(sessionStorage). 빈 칸 + = 그 날짜·시간이 채워진 추가 창.
|
||||
카드 머리 왼쪽 위 = 호스트 쇼핑몰 작은 아이콘(2026-11-06, 예전 ✥ 대신 — 머리 전체가 끌기 손잡이), 카드 머리 = **Tiktok Handle**(없으면 이름, 색 = 호스트 id 순 `HOST_COLORS`), SALES·COM·Fee. 카드 머리를 끌어 빈 칸으로 = 옮기기(`move`, 방송 길이 유지) · 다른 카드 위 = 맞바꾸기(`swap_with`, 날짜·시간 교환). 다시 그린 뒤 가로 위치 유지(sessionStorage). 빈 칸 + = 그 날짜·시간이 채워진 추가 창.
|
||||
**AD SPEND** = 그날 방송 광고비(`ad_spend`) 합(2026-11-06 — 예전 날짜별 입력 `live_daily_ad_spend`·✎ 버튼·`/live/ad-spend` 없앰, 표는 값만 남김), ROAS = 판매금액 ÷ 광고비(광고비 없으면 `-`).
|
||||
- **한 화면 맞춤**(2026-11-05) — 달력 보기는 넓은 화면(1101px 이상)에서 페이지 세로 스크롤 없음: `.lv-cal-wrap` 이 남은 높이를 쓰고, 풀HD 브라우저(세로 880px 이상)면 방송이 없는 달은 18개 시간 칸·합계 줄이 표 안 스크롤 없이 들어간다(카드가 있는 줄은 카드 높이만큼 커져서 방송이 많으면 표 안에서 스크롤, 페이지는 안 움직임). **방송이 걸친 칸은 합친다**(2026-11-06, `store._covered_slots` → `rowspan`, 가려진 칸 `skip`) — 2시간 방송 = 두 칸, 끝이 정각이 아니면 그 칸까지, 자정 넘김은 그날 마지막 칸까지. 합친 칸 안에서 시작하는 다른 방송은 같은 칸에 들어가고 칸이 더 늘어난다(겹친 방송). 끌어 놓기는 합친 칸의 첫 시간으로. 카드·표 글자·칸 크기를 늘리면 `live_calendar.browser.test.js` 로 다시 확인.
|
||||
- **오른쪽 달력**(2026-11-05, 달력 보기만, 세로 2분할 `.lv-split`, 240px = 공용 달력의 80%, 예전 날짜로 이동 줄 대신, 공용 `erp-datepop` `mountRange` + `locale` 옵션으로 영문) — 날짜를 누르면 그 날이 표 맨 왼쪽(마지막 날까지 — `endGap` 이 표 끝에 여백), 다른 달이면 그 달 화면으로 가서 맨 왼쪽(sessionStorage `lv_cal_jump`). 표시만 하고 요금·일수에 안 씀. 글자 굵게, **방송 있는 날 = 숫자 오른쪽 위 초록 점**(2026-11-06, `db.broadcast_days` 보는 달 ±1년 → `#lv-live-days`, 공용 `mountRange` 의 `dayClass` 옵션 → `has-live`). 테스트 `tests/js/live_calendar.browser.test.js`(`render_live.py`).
|
||||
|
||||
@@ -88,7 +88,7 @@ class LiveDBStore:
|
||||
"""start 이상 end 미만, 날짜·시간 순. 줄마다 images = [{id, filename}](내용 제외)."""
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT b.*, COALESCE(NULLIF(h.display_name, ''), h.full_name) AS host_name FROM live_broadcasts b JOIN live_hosts h ON h.id = b.host_id "
|
||||
"SELECT b.*, COALESCE(NULLIF(h.display_name, ''), h.full_name) AS host_name, h.platform AS host_platform FROM live_broadcasts b JOIN live_hosts h ON h.id = b.host_id "
|
||||
"WHERE b.broadcast_date >= %s AND b.broadcast_date < %s ORDER BY b.broadcast_date, b.start_time, b.id",
|
||||
(start, end)).fetchall()
|
||||
images = conn.execute(
|
||||
|
||||
@@ -160,6 +160,7 @@ def broadcast_view(b: dict[str, Any], lang: str = "ko") -> dict[str, Any]:
|
||||
return {
|
||||
"date": fmt_date(b["broadcast_date"], lang), "times": fmt_times(b["start_time"], b["end_time"]),
|
||||
"host_name": b["host_name"], "tiktok_handle": b["tiktok_handle"], "venue": b["venue"],
|
||||
"platform": b["host_platform"], # 호스트 쇼핑몰(tiktok·shopee, '' = 아직 안 고름) — 아이콘 /static/live-icon-<값>.png
|
||||
"sales": fmt_money(b["sales_amount"]), "base": fmt_money(pay["base"]), "commission": fmt_money(pay["commission"]),
|
||||
"ad_spend": fmt_money(b["ad_spend"]), "host_fee": fmt_money(b["host_fee"]),
|
||||
"images": b["images"], "id": b["id"],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{#- 라이브 커머스 달력 보기(2026-11-04) — 줄 = 2시간 칸, 열 = 날짜, 맨 아래 = 날짜별 합계. 카드 머리 = 호스트 간단한 이름 + 그 방송의 틱톡 계정.
|
||||
카드 머리를 끌어 빈 칸으로 옮기거나 다른 카드 위에 놓아 맞바꾼다(live.js). 문구 = t()(i18n.py), 영문은 CSS 로 대문자(받은 화면과 같게). -#}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106g" />
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106h" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<link rel="stylesheet" href="/static/erp-datepop.css?v=20261102a" />{% endblock %}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
{% for c in cell.cards %}
|
||||
<article class="lv-card" data-card="{{ c.id }}">
|
||||
<header class="lv-card-head" draggable="true" style="background:{{ c.color }}" title="{{ c.host_name }} · {{ c.times }}{% if c.venue %} · {{ c.venue }}{% endif %}">
|
||||
<span class="lv-card-grip" aria-hidden="true">✥</span>
|
||||
{% if c.platform %}<img class="lv-card-pf" src="/static/live-icon-{{ c.platform }}.png" alt="{{ {'tiktok': 'TikTok', 'shopee': 'Shopee'}[c.platform] }}" />{% endif %}
|
||||
<span class="lv-card-name">{{ c.label }}{% if c.tiktok_handle %}<small>@{{ c.tiktok_handle }}</small>{% endif %}</span>
|
||||
<button type="button" class="lv-card-edit" data-edit='{{ c.edit | tojson }}' aria-label="{{ t('{name} {date} {times} 고치기').format(name=c.label, date=c.date, times=c.times) }}">✎</button>
|
||||
</header>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{#- 라이브 커머스 스케줄표(2026-11-04) — 달마다 방송 목록. 추가·고치기 창은 달력과 공용(_dialog.html, live.js). 문구 = t()(i18n.py). -#}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106g" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106h" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="lv" lang="{{ lang }}">
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
<div class="erp-card-block">
|
||||
<div class="erp-table-wrap">
|
||||
<table class="erp-table lv-table">
|
||||
<thead><tr><th>{{ t('날짜') }}</th><th>{{ t('시간') }}</th><th>{{ t('호스트') }}</th><th class="lv-r">{{ t('판매금액(RM)') }}</th><th class="lv-r">{{ t('시간 요금(RM)') }}</th><th class="lv-r">{{ t('커미션 10%(RM)') }}</th><th class="lv-r">{{ t('광고비(RM)') }}</th><th class="lv-r">{{ t('호스트 비용(RM)') }}</th><th>{{ t('방송 결과') }}</th><th></th></tr></thead>
|
||||
{% set platform_names = {"tiktok": "TikTok", "shopee": "Shopee"} %}
|
||||
<table class="erp-table lv-table lv-sched">
|
||||
<thead><tr><th>{{ t('쇼핑몰') }}</th><th>{{ t('날짜') }}</th><th>{{ t('시간') }}</th><th>{{ t('호스트') }}</th><th class="lv-r">{{ t('판매금액(RM)') }}</th><th class="lv-r">{{ t('시간 요금(RM)') }}</th><th class="lv-r">{{ t('커미션 10%(RM)') }}</th><th class="lv-r">{{ t('광고비(RM)') }}</th><th class="lv-r">{{ t('호스트 비용(RM)') }}</th><th>{{ t('방송 결과') }}</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
{% for r in rows %}
|
||||
<tr>
|
||||
<td class="lv-c" data-label="{{ t('쇼핑몰') }}">{% if r.platform %}<img class="lv-pf" src="/static/live-icon-{{ r.platform }}.png" alt="{{ platform_names[r.platform] }}" title="{{ platform_names[r.platform] }}" />{% endif %}</td>
|
||||
<td class="lv-nowrap" data-label="{{ t('날짜') }}">{{ r.date }}</td>
|
||||
<td class="lv-nowrap" data-label="{{ t('시간') }}">{{ r.times }}</td>
|
||||
<td data-label="{{ t('호스트') }}">{{ r.host_name }}{% if r.tiktok_handle %}<div class="lv-sub">@{{ r.tiktok_handle }}</div>{% endif %}</td>
|
||||
@@ -28,7 +30,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="10" class="erp-empty">{{ t('이 달에 등록한 방송이 없습니다.') }}</td></tr>
|
||||
<tr><td colspan="11" class="erp-empty">{{ t('이 달에 등록한 방송이 없습니다.') }}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{#- 라이브 커머스 설정(2026-11-04) — 호스트 정보. 계좌 등 개인정보·지우기는 ERP 관리자만(router.settings), 칩 권한자는 이름·상태만 보임 — `live_host` = 새 등록, `live_host_edit` = 고치기(개인정보는 빈칸으로 열림, 비워 두면 그대로). 추가·고치기는 같은 창(live.js). 문구 = t()(i18n.py). -#}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106g" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261106h" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{#- 쇼핑몰(005, store.PLATFORMS) — 로고는 말레이시아 배송 모듈 이미지 -#}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
+6
-2
@@ -14,6 +14,10 @@
|
||||
.lv-table tr.lv-off td { color: var(--color-midtone-gray, #666); }
|
||||
.lv-r { text-align: right; }
|
||||
.lv-table th.lv-r { text-align: right; }
|
||||
/* 스케줄표 머리글(2026-11-06) — 가운데·굵게·검정·공용 크기의 112% */
|
||||
.lv-table.lv-sched thead th { text-align: center; font-weight: 700; color: #000; font-size: calc(var(--text-caption, 13px) * 1.12); }
|
||||
.lv-c { text-align: center; }
|
||||
.lv-pf { display: inline-block; width: 22px; height: 22px; vertical-align: middle; }
|
||||
.lv-num { font-variant-numeric: tabular-nums; }
|
||||
.lv-nowrap { white-space: nowrap; }
|
||||
.lv-sub { margin: 0; font-size: 12px; color: var(--color-midtone-gray, #666); }
|
||||
@@ -24,7 +28,7 @@
|
||||
/* 공용 .erp-table 은 640px 아래에서 제목 줄을 숨기고 카드로 바뀐다 — 칸 이름을 칸마다 보여 준다 */
|
||||
@media (max-width: 640px) {
|
||||
.lv-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--color-midtone-gray, #666); text-align: left; }
|
||||
.lv-table td.lv-r { text-align: left; }
|
||||
.lv-table td.lv-r, .lv-table td.lv-c { text-align: left; }
|
||||
}
|
||||
|
||||
.lv-views { display: inline-flex; gap: 4px; margin-left: 10px; }
|
||||
@@ -117,7 +121,7 @@
|
||||
.lv-card-head { display: flex; align-items: center; gap: 3px; padding: 1px 4px; border-bottom: 1px solid #1f2937; cursor: grab; }
|
||||
.lv-card-head:active { cursor: grabbing; }
|
||||
.lv-card-name small { display: block; overflow: hidden; text-overflow: ellipsis; text-transform: none; font-size: 9px; line-height: 1.1; font-weight: 600; letter-spacing: 0; }
|
||||
.lv-card-grip { font-size: 10px; color: #374151; }
|
||||
.lv-card-pf { flex: none; width: 12px; height: 12px; } /* 호스트 쇼핑몰 아이콘(예전 ✥ 자리) */
|
||||
.lv-card-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .03em; color: #111; }
|
||||
.lv-card-edit { padding: 0 2px; border: 0; background: none; color: #374151; font-size: 11px; cursor: pointer; }
|
||||
.lv-card-nums { display: grid; grid-template-columns: 1fr 1fr; }
|
||||
|
||||
@@ -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