Merge branch 'fix/coupang-ad-skip-empty'

This commit is contained in:
2026-10-14 17:43:00 +09:00
8 changed files with 17 additions and 17 deletions
+3 -1
View File
@@ -198,7 +198,9 @@ def parse_coupang_rocket(content: bytes, *, today: date, filename: str = "") ->
break
res.entries = sorted(sums.items())
res.empty_days = sorted(d for d in dated if d not in sums and d <= today)
if not res.entries and not res.errors:
# 날짜 줄은 있는데 청구금액이 한 줄도 없는 파일(그 달 광고비 0 등)은 오류가 아니라 넘어간다(2026-10-14 사용자 요청).
# 날짜 줄 자체가 없을 때만 양식 오류.
if not dated and not res.errors:
raise UploadError("광고비 날짜 줄이 없습니다. 1열 날짜(예: 2026년 10월 01일), 19열 청구금액(+부가가치세) 양식인지 확인하세요.")
return res
@@ -214,4 +214,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014e" defer></script>{% endblock %}
@@ -255,4 +255,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014e" defer></script>{% endblock %}
@@ -204,4 +204,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014e" defer></script>{% endblock %}
@@ -76,6 +76,11 @@ def test_coupang_report_date_rows_col19_summed_empty_skipped():
assert not res.errors, res.errors
assert res.entries == [(date(2026, 3, 1), 38), (date(2026, 3, 3), 1)]
assert res.empty_days == [date(2026, 3, 2)]
# 청구금액이 한 줄도 없는 파일(날짜 줄만) — 오류 없이 넘어감(반영할 날 없음)
none = "\n".join([head, "2026-03-01,,,,VENDOR,PA,매출 성장,1,캠페인A,Adcost,DAILY_SOFT,1000,0,0,0,0,0,,",
"2026-03-02,,,,VENDOR,PA,매출 성장,1,캠페인A,Adcost,DAILY_SOFT,1000,0,0,0,0,0,,"]) + "\n"
r0 = ads.parse_coupang_rocket(_xlsx(none), today=TODAY, filename="march.xlsx")
assert r0.entries == [] and not r0.errors and r0.empty_days == [date(2026, 3, 1), date(2026, 3, 2)]
m, _ = ads.merge_results([("a.xlsx", 1.0, ads.parse_coupang_rocket(wing.encode("utf-8"), today=TODAY)),
("b.csv", 2.0, ads.ParseResult(entries=[(date(2026, 3, 2), 7)]))])
assert m.empty_days == [] and dict(m.entries)[date(2026, 3, 2)] == 7 # 다른 파일에 값이 있으면 빈 날 아님
+3 -11
View File
@@ -376,17 +376,9 @@
return;
}
saved = body.saved > 0;
const empty = body.empty_days || [];
// 업로드가 끝나면 창을 닫고 표·합계·그래프를 다시 그린다(onClose 새로고침). 금액이 없던 날짜가 있으면 알려 주고 창을 둔다.
if (saved && !empty.length) { m.close(); return; }
if (saved) {
out.innerHTML = '<p class="perf-notice is-ok">' + esc(body.name) + " " + fmt(body.saved) + "일 반영 · 합계 " + fmt(body.total) + "원</p>" +
'<p class="perf-notice is-warn">날짜 줄은 있지만 19열 금액이 없어 건너뛴 날짜 ' + empty.length + "일: " +
esc(empty.join(", ")) + "</p>" + '<p class="perf-muted" style="margin:6px 0 0">창을 닫으면 표·합계·그래프가 다시 계산됩니다.</p>';
fileInput.value = "";
return;
}
out.innerHTML = '<p class="perf-notice is-ok">반영할 날짜가 없습니다.</p>';
// 업로드가 끝나면 창을 닫고 표·합계·그래프를 다시 그린다(onClose 새로고침). 청구금액이 없는 날짜·파일은 그냥 넘어간다.
if (saved) { m.close(); return; }
out.innerHTML = '<p class="perf-notice is-ok">청구금액이 있는 날짜가 없어 반영한 날이 없습니다.</p>';
fileInput.value = "";
});
});
+2 -1
View File
@@ -358,7 +358,8 @@
1열 날짜(`2026년 10월 01일`), 19열 청구금액(+부가가치세). **1열에 날짜가 있는 줄의 19열 값**(2026-10-14 — 윙 보고서는
캠페인 줄에도 날짜가 있고 19열이 비어 있어 예전엔 "청구금액이 비어 있습니다" 로 막혔다): 19열이 빈 줄은 건너뛰고,
같은 날짜에 값이 있는 줄이 여럿이면 더한다. "전체" 합계 줄·머리글·1열이 빈 캠페인 줄은 건너뜀. 날짜 줄은 있는데
값이 한 줄도 없던 날은 응답 `empty_days` — 업로드 창이 닫히지 않고 그 날짜를 알려 준다.
값이 한 줄도 없던 날은 넘어간다(응답 `empty_days` 에만, 창은 그대로 닫힘). 청구금액이 한 줄도 없는 파일도 오류 없이 넘어감
(날짜 줄 자체가 없을 때만 양식 오류).
- **네이버**(2026-10-14) = 네이버 광고 보고서 CSV·엑셀(하루 한 줄): 3열 기간(`2026.09.30.`), 4열 총비용 = 광고비,
12열 구매완료 광고수익률(%) = 그날 ROAS(`roas`), 나머지 항목(노출수·클릭수·클릭률·전환수·구매완료 수·장바구니·총 전환매출액 …)은
머리글 이름 그대로 `metrics`(JSONB). 광고 계정 이름·ID 는 넣지 않음. 직접 입력으로 광고비를 고쳐도 ROAS·상세는 그대로.
+1 -1
View File
@@ -211,7 +211,7 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
Object.defineProperty(modal2.querySelector(".perf-upload-file"), "files", { value: [f] });
Array.from(modal2.querySelectorAll("button")).filter(function (b) { return b.textContent === "업로드"; })[0].click();
await settle();
check("[업로드] 금액 없던 날짜 → 창 유지 + 날짜 안내", e.d.body.contains(modal2) && /건너뛴 날짜 1일: 2026-03-02/.test(modal2.textContent), modal2.textContent);
check("[업로드] 청구금액 없던 날짜가 있어도 넘어가고 창 닫힘", !e.d.body.contains(modal2), modal2.textContent);
}
// ── 네이버 — 보고서 ROAS 표시 · 머리글 → 일자별 보고서 항목 ──
{