Merge branch 'feat/project-subtask-ux-ad-roas'

This commit is contained in:
2026-10-14 10:57:32 +09:00
25 changed files with 178 additions and 51 deletions
+2 -2
View File
File diff suppressed because one or more lines are too long
+56 -7
View File
@@ -17,20 +17,46 @@ import csv
import io
from dataclasses import dataclass, field
from datetime import date
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Callable, Mapping, Sequence
from . import calc
from .manual_upload import MAX_AMOUNT, MAX_DATA_ROWS, MAX_ERRORS, MAX_FILE_BYTES, UploadError, parse_amount, parse_date
# 채널 — 표 열 순서. upload = 업로드 양식이 정해진 채널(파일 읽기 함수가 있는 채널).
# 채널 — 표 열 순서(2026-10-14 사용자 지정). 쇼핑몰 채널 코드는 실적 쇼핑몰 코드와 같다(쿠팡(윙)만 coupang_wing ↔ 매출 coupang).
CHANNELS: tuple[tuple[str, str], ...] = (
("google", "구글"),
("meta", "메타"),
("naver", "네이버"),
("coupang_wing", "쿠팡(윙)"),
("coupang_rocket", "쿠팡(로켓)"),
("ohouse", "오늘의집"),
("gmarket", "G마켓"),
("kakao", "카카오"),
("gsshop", "GS샵"),
("elevenst", "11번가"),
("lotteon", "롯데ON"),
("toss", "토스"),
("atomy", "애터미아자몰"),
)
CHANNEL_NAMES = dict(CHANNELS)
CHANNEL_CODES = tuple(c for c, _ in CHANNELS)
# ROAS(매출 ÷ 광고비 × 100) 의 매출 = 이 쇼핑몰 매출 실적 총매출. 구글·메타는 자체몰(카페24)로 보내는 광고라 카페24 매출.
ROAS_SALES_CODE: dict[str, str] = {c: c for c in CHANNEL_CODES}
ROAS_SALES_CODE.update({"google": "cafe24", "meta": "cafe24", "coupang_wing": "coupang"})
def roas(sales: int, spend: int) -> int | None:
"""ROAS(%) = 매출 ÷ 광고비 × 100, 정수로 반올림. 광고비가 없으면 None."""
if not spend or spend <= 0:
return None
return int((Decimal(int(sales)) * 100 / Decimal(int(spend))).quantize(Decimal(1), rounding=ROUND_HALF_UP))
def roas_basis(code: str) -> str:
"""머리글 말풍선 — ROAS 에 쓰는 매출."""
sales = ROAS_SALES_CODE[code]
return "카페24(자체몰)" if sales == "cafe24" else CHANNEL_NAMES.get(code, code)
ROCKET_DATE_COL = 0 # 1열 날짜
ROCKET_AMOUNT_COL = 18 # 19열 청구금액(+부가가치세)
@@ -169,10 +195,16 @@ def build_ad_dashboard(store: Any, *, kind: str, anchor: date, today: date,
ytd = calc.sum_range(cells, codes, year_period.start, year_period.end)
y_prev = calc.sum_range(cells, codes, y_cmp_start, y_cmp_end)
sales_total = None
if sales_codes:
daily = store.daily_amounts(period.start, period.end, list(sales_codes))
sales_total = sum(int(v) for v in daily.values())
# 매출(ROAS 용) — 채널별 매출 쇼핑몰 + 매출 실적에 들어가는 쇼핑몰 전부(합계 열 ROAS·매출 대비 광고비)
total_codes = list(sales_codes)
need = sorted(set(ROAS_SALES_CODE.values()) | set(total_codes))
sales = {(d, c): int(v) for (d, c), v in store.daily_amounts(q_start, q_end, need).items()}
def sales_sum(mcodes: Sequence[str], s: date, e: date) -> int:
want = set(mcodes)
return sum(v for (d, c), v in sales.items() if c in want and s <= d <= e)
sales_total = sales_sum(total_codes, period.start, period.end) if total_codes else None
ratio = round(cur.gross / sales_total * 100, 1) if sales_total and sales_total > 0 else None
word = {"day": "오늘" if period.start == today else "해당일",
@@ -213,6 +245,22 @@ def build_ad_dashboard(store: Any, *, kind: str, anchor: date, today: date,
share = calc.by_code(cells, codes, period.start, period.end)
month = calc.month_summary(month_period.start.year, month_period.start.month, codes, cells)
table = calc.main_table(period, codes, cells, today=today, holidays=holidays)
# 칸마다 ROAS — "광고비(ROAS%)" 로 보인다. 행 기간 = 그 날·주·월(합계 행은 선택 기간)
for row in table:
s = date.fromisoformat(row["from"]) if row.get("from") else period.start
e = date.fromisoformat(row["to"]) if row.get("to") else period.end
row["roas"] = {c: roas(sales_sum([ROAS_SALES_CODE[c]], s, e), row["cells"][c]["gross"]) for c in codes}
row["roas_total"] = roas(sales_sum(total_codes, s, e), row["total"]["gross"]) if total_codes else None
m_s, m_e = month_period.start, month_period.end
for r in month["rows"]:
r["roas"] = roas(sales_sum([ROAS_SALES_CODE[r["code"]]], m_s, m_e), r["gross"])
month["total"]["roas"] = roas(sales_sum(total_codes, m_s, m_e), month["total"]["gross"]) if total_codes else None
year = calc.year_months(year_period.start.year, codes, cells, today=today)
for i, r in enumerate(year["rows"], start=1):
s = date(year_period.start.year, i, 1)
r["roas"] = None if r.get("future") or not total_codes else roas(sales_sum(total_codes, s, calc.month_end(s)), r["gross"] or 0)
year["total"]["roas"] = roas(sales_sum(total_codes, year_period.start, year_period.end), year["total"]["gross"]) if total_codes else None
return {
"nav": nav,
"period": period,
@@ -221,9 +269,10 @@ def build_ad_dashboard(store: Any, *, kind: str, anchor: date, today: date,
"codes": codes,
"names": dict(CHANNEL_NAMES),
"kpis": kpis,
"table": calc.main_table(period, codes, cells, today=today, holidays=holidays),
"table": table,
"month": month,
"year": calc.year_months(year_period.start.year, codes, cells, today=today),
"year": year,
"roas_basis": {c: roas_basis(c) for c in codes},
"chart_daily": calc.daily_series(period, codes, cells),
"chart_share": [{"code": c, "name": CHANNEL_NAMES[c], **share[c].as_dict()} for c in codes],
# 업로드로 들어온 칸(표시용) — "날짜|채널"
@@ -1,6 +1,9 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261013d" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261014a" />{% endblock %}
{#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#}
{%- macro roas(p) -%}{%- if p is not none -%}<span class="perf-roas">({{ "{:,}".format(p) }}%)</span>{%- endif -%}{%- endmacro -%}
{%- macro won(v) -%}
{%- if v is none -%}<span class="perf-na"></span>
@@ -79,7 +82,7 @@
<thead>
<tr>
<th class="perf-th-label">{% if period_kind == 'year' %}월{% else %}날짜{% endif %}</th>
{% for c in codes %}<th title="{{ names[c] }} — 날짜 칸을 눌러 입력">{{ names[c] }} <span class="perf-manual-mark" aria-hidden="true">✎</span></th>{% endfor %}
{% for c in codes %}<th title="{{ names[c] }} — 날짜 칸을 눌러 광고비 입력. 괄호 = ROAS({{ roas_basis[c] }} 매출 ÷ 광고비)">{{ names[c] }} <span class="perf-manual-mark" aria-hidden="true">✎</span></th>{% endfor %}
<th class="perf-th-total">{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %}</th>
</tr>
</thead>
@@ -95,12 +98,12 @@
{% set up = (r.date ~ '|' ~ c) in upload_cells %}
<td class="perf-num is-manual-cell{% if v and not up %} is-manual{% endif %}{% if up %} is-upload{% endif %}"
data-manual-code="{{ c }}" data-date="{{ r.date }}" data-manual-value="{{ v if v else '' }}" tabindex="0"
title="{% if up %}파일 업로드 값 — 눌러 고치기{% else %}눌러 광고비 입력(비우고 저장하면 지움){% endif %}"><span class="v v-gross">{{ won(v) }}</span></td>
title="{% if up %}파일 업로드 값 — 눌러 고치기{% else %}눌러 광고비 입력(비우고 저장하면 지움){% endif %}"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% else %}
<td class="perf-num"><span class="v v-gross">{{ won(v) }}</span></td>
<td class="perf-num"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% endif %}
{% endfor %}
<td class="perf-num perf-td-total"><span class="v v-gross">{{ won(r.total.gross) }}</span></td>
<td class="perf-num perf-td-total"><span class="v v-gross">{{ won(r.total.gross) }}</span>{{ roas(r.roas_total) }}</td>
</tr>
{% endfor %}
</tbody>
@@ -108,6 +111,7 @@
</div>
{% if period_kind != 'year' %}
<p class="perf-muted perf-manual-help">날짜 칸을 눌러 그날 <b>광고비</b>를 직접 입력합니다 — Enter 저장 후 아래 칸, Esc 취소, 비우고 저장하면 지움.
칸은 <b>광고비(ROAS%)</b> — ROAS = 그 쇼핑몰 매출 실적 총매출 ÷ 광고비(구글·메타는 카페24 자체몰 매출, 합계 열은 전체 매출).
파란 숫자 = 직접 입력, 주황 숫자 = 파일 업로드 값. 쿠팡(윙)·쿠팡(로켓)은 [파일 업로드]로 광고 보고서를 올리면 날짜별로 한 번에 들어갑니다.</p>
{% endif %}
</div>
@@ -131,12 +135,13 @@
<div class="perf-card-head"><h2 class="perf-h">{{ month.label }} 채널별 광고비</h2></div>
<div class="erp-table-wrap">
<table class="perf-table">
<thead><tr><th class="perf-th-label">채널</th><th>광고비</th><th>비중</th></tr></thead>
<thead><tr><th class="perf-th-label">채널</th><th>광고비</th><th>ROAS</th><th>비중</th></tr></thead>
<tbody>
{% for r in month.rows %}
<tr>
<th class="perf-td-label" scope="row">{{ names[r.code] }}</th>
<td class="perf-num">{{ won(r.gross) }}</td>
<td class="perf-num">{% if r.roas is not none %}{{ "{:,}".format(r.roas) }}%{% else %}<span class="perf-zero">–</span>{% endif %}</td>
<td class="perf-num perf-share">
{% if r.share is not none %}<span class="perf-bar" style="--w: {{ [r.share, 0] | max }}%"></span>{{ "%.1f" | format(r.share) }}%{% else %}<span class="perf-zero">–</span>{% endif %}
</td>
@@ -147,6 +152,7 @@
<tr class="perf-row-total">
<th class="perf-td-label" scope="row">합계</th>
<td class="perf-num">{{ won(month.total.gross) }}</td>
<td class="perf-num">{% if month.total.roas is not none %}{{ "{:,}".format(month.total.roas) }}%{% else %}<span class="perf-zero">–</span>{% endif %}</td>
<td class="perf-num">{% if month.total.share is not none %}100%{% else %}<span class="perf-zero">–</span>{% endif %}</td>
</tr>
</tfoot>
@@ -161,12 +167,13 @@
</div>
<div class="erp-table-wrap">
<table class="perf-table perf-year">
<thead><tr><th class="perf-th-label">월</th><th>광고비</th></tr></thead>
<thead><tr><th class="perf-th-label">월</th><th>광고비</th><th>ROAS</th></tr></thead>
<tbody>
{% for r in year.rows %}
<tr class="{% if r.future %}is-future{% endif %}">
<th class="perf-td-label" scope="row">{{ r.label }}</th>
<td class="perf-num">{{ won(r.gross) }}</td>
<td class="perf-num">{% if r.roas is not none %}{{ "{:,}".format(r.roas) }}%{% elif not r.future %}<span class="perf-zero">–</span>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
@@ -174,6 +181,7 @@
<tr class="perf-row-total">
<th class="perf-td-label" scope="row">합계</th>
<td class="perf-num">{{ won(year.total.gross) }}</td>
<td class="perf-num">{% if year.total.roas is not none %}{{ "{:,}".format(year.total.roas) }}%{% else %}<span class="perf-zero">–</span>{% endif %}</td>
</tr>
</tfoot>
</table>
@@ -182,7 +190,8 @@
</div>
<p class="perf-foot perf-muted">
광고비 기준: 쿠팡(윙)·쿠팡(로켓)은 광고 보고서의 청구금액(+부가가치세). 매출 대비 광고비 = 같은 기간 광고비 ÷ 매출 실적 총매출.
광고비 기준: 쿠팡(윙)·쿠팡(로켓)은 광고 보고서의 청구금액(+부가가치세). ROAS = 매출 ÷ 광고비 × 100(구글·메타 = 카페24 자체몰 매출).
매출 대비 광고비 = 같은 기간 광고비 ÷ 매출 실적 총매출.
구글·메타는 지금은 직접 입력합니다.
</p>
</section>
@@ -201,4 +210,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261013d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261013d" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261014a" />{% endblock %}
{%- macro won(v) -%}
{%- if v is none -%}<span class="perf-na"></span>
@@ -255,4 +255,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261013d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261013d" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261014a" />{% endblock %}
{%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%}
@@ -204,4 +204,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261013d" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261014a" defer></script>{% endblock %}
+18 -3
View File
@@ -83,13 +83,16 @@ class _Store:
return {k: v[0] for k, v in rows.items()}, {k: v[1] for k, v in rows.items()}
def daily_amounts(self, start, end, codes):
return {(date(2026, 10, 5), "cafe24"): 2_700_000}
rows = {(date(2026, 10, 5), "cafe24"): 2_700_000, (date(2026, 10, 1), "coupang_rocket"): 550_000,
(date(2026, 10, 3), "coupang_rocket"): 110_000}
return {k: v for k, v in rows.items() if start <= k[0] <= end and k[1] in codes}
def test_ad_dashboard_month():
ctx = ads.build_ad_dashboard(_Store(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7),
sales_codes=["cafe24"])
assert ctx["codes"] == ["google", "meta", "coupang_wing", "coupang_rocket"]
assert ctx["codes"] == ["google", "meta", "naver", "coupang_wing", "coupang_rocket", "ohouse", "gmarket", "kakao",
"gsshop", "elevenst", "lotteon", "toss", "atomy"]
k = {x["key"]: x for x in ctx["kpis"]}
assert k["spend"]["value"] == 270000 and k["ratio"]["pct"] == 10.0 # 270,000 ÷ 2,700,000
assert k["ytd"]["value"] == 370000 and k["mtd"]["value"] == 270000
@@ -98,6 +101,18 @@ def test_ad_dashboard_month():
day1 = next(r for r in ctx["table"] if r.get("date") == "2026-10-01")
assert day1["cells"]["coupang_rocket"]["gross"] == 220000 and day1["total"]["gross"] == 220000
assert ctx["table"][-1]["kind"] == "total" and ctx["table"][-1]["total"]["gross"] == 270000
# ROAS = 그 쇼핑몰 매출 ÷ 광고비 — 로켓 10/1: 550,000 ÷ 220,000 = 250%, 구글 10/2: 카페24 그날 매출 0 → 0%
assert day1["roas"]["coupang_rocket"] == 250 and day1["roas"]["google"] is None
day2 = next(r for r in ctx["table"] if r.get("date") == "2026-10-02")
assert day2["roas"]["google"] == 0
total = ctx["table"][-1]
assert total["roas"]["coupang_rocket"] == 300 and total["roas"]["google"] == 5400 # 660,000÷220,000 · 2,700,000÷50,000
assert total["roas_total"] == 1000 # 2,700,000 ÷ 270,000 (합계 = sales_codes)
m = {r["code"]: r for r in ctx["month"]["rows"]}
assert m["coupang_rocket"]["roas"] == 300 and m["naver"]["roas"] is None and ctx["month"]["total"]["roas"] == 1000
assert ctx["year"]["rows"][9]["roas"] == 1000 and ctx["year"]["rows"][10]["roas"] is None # 11월 = 앞으로
assert ctx["roas_basis"]["google"] == "카페24(자체몰)" and ctx["roas_basis"]["coupang_wing"] == "쿠팡(윙)"
assert ads.roas(1, 3) == 33 and ads.roas(1, 200) == 1 and ads.roas(5, 0) is None # 0.5% 반올림 → 1
assert ctx["nav"]["quick"][2]["active"] # 이번달
@@ -160,7 +175,7 @@ def test_ad_spend_endpoints(monkeypatch):
assert client.put("/performance/api/ad-spend/meta/2026-10-12", json={"amount": "33,000"}).json()["amount"] == 33000
assert client.put("/performance/api/ad-spend/meta/2026-10-11", json={"amount": ""}).status_code == 200
assert store.saved == [("meta", date(2026, 10, 12), 33000, "manual"), ("meta", date(2026, 10, 11), None, "manual")]
assert client.put("/performance/api/ad-spend/naver/2026-10-12", json={"amount": 1}).status_code == 404
assert client.put("/performance/api/ad-spend/cafe24/2026-10-12", json={"amount": 1}).status_code == 404
assert client.put("/performance/api/ad-spend/meta/2026-10-14", json={"amount": 1}).status_code == 400
assert client.put("/performance/api/ad-spend/meta/2026-10-12", json={"amount": "abc"}).status_code == 400
store.missing = True
+2 -1
View File
@@ -1516,7 +1516,8 @@ def _create_task_for(
raise HTTPException(status_code=404, detail=str(exc))
# 만든 사람은 자동 협업자 + 만들 때 고른 협업자(세부 업무 추가 칸 등). 담당자는 협업자가 아니다(2026-10-13,
# db.add_followers 가 담당자를 거른다 — 만든 사람이 담당자여도 빠진다).
_follow(st, task["id"], [user["email"]] + followers)
# 세부 업무는 만든 사람을 자동으로 넣지 않는다 — 고른 협업자만(2026-10-14 사용자 요청).
_follow(st, task["id"], ([] if task.get("parent_task_id") else [user["email"]]) + followers)
# 생성과 동시에 담당자 지정 시 관리자 메일 + 담당자 인앱 알림
if task.get("assignee_email"):
_notify(
@@ -1,7 +1,7 @@
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -298,5 +298,5 @@
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -207,5 +207,5 @@
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -102,5 +102,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -108,5 +108,5 @@
});
})();
</script>
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -470,5 +470,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261013i" />
<link rel="stylesheet" href="/static/project.css?v=20261014a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -70,5 +70,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261013i" defer></script>
<script src="/static/project.js?v=20261014a" defer></script>
{% endblock %}
+4
View File
@@ -58,6 +58,10 @@ a.perf-tab.is-active:link, a.perf-tab.is-active:visited { color: #fff; }
.perf-ads .perf-quick .perf-seg.is-active { background: var(--perf-ad); }
.perf-ads .perf-chart .bar { fill: var(--perf-ad); }
.perf-ads td.is-upload .v-gross { color: var(--perf-ad); }
/* "광고비(ROAS%)" — ROAS 는 작게 옅게 붙인다. 입력 중엔 숫자처럼 자리만 남기고 숨김 */
.perf-roas { margin-left: 2px; font-size: 11px; font-weight: 500; color: var(--color-midtone-gray); }
.perf-row-total .perf-roas { color: #bbb; }
.perf .perf-main td.is-editing .perf-roas { visibility: hidden; }
.perf-ad-upload-btn { margin-left: auto; }
.perf-kpi-pct { font-size: 26px; font-weight: 700; }
+2
View File
@@ -488,6 +488,8 @@
td.dataset.manualValue = manual;
td.classList.toggle("is-manual", manual !== "");
td.classList.remove("is-upload");
const ro = td.querySelector(".perf-roas"); // 광고비가 바뀌면 ROAS 는 새로고침 때 다시 계산
if (ro) ro.remove();
td.title = manual !== "" ? "직접 입력값 — 눌러 고치기(비우고 저장하면 " + (FIXED_METRIC ? "지움" : "API 값") + ")"
: "눌러 " + MANUAL_WORD + " 직접 입력";
const g = td.querySelector(".v-gross");
+3 -2
View File
@@ -1446,7 +1446,7 @@ label.pj-desc-fmtbtn {
}
.pj-subtask-title:hover, .pj-subtask-title:focus { border-color: #d8dce2 !important; background: #fff; }
.pj-subtask-fill { flex: 1 1 0; align-self: stretch; min-width: 8px; }
/* 마감일 — 날짜 글자만(아사나). 없으면 줄에 마우스를 올릴 때만 점선 원 달력 아이콘 */
/* 마감일 — 날짜 글자만(아사나). 없으면 점선 원 달력 아이콘을 협업자 아이콘처럼 늘 옅게(줄 hover 때 진하게, 2026-10-14) */
.pj-subtask-due {
flex: 0 0 auto; white-space: nowrap; font-size: 12px; color: var(--pj-ink-soft);
padding: 2px 4px; border-radius: 4px; cursor: pointer;
@@ -1456,7 +1456,7 @@ label.pj-desc-fmtbtn {
.pj-subtask-due.is-soon { color: #3f8f6b; }
.pj-subtask-due.is-empty {
display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
border-radius: 50%; color: #6d6e6f; opacity: 0; transition: opacity .12s;
border-radius: 50%; color: #6d6e6f; opacity: .5; transition: opacity .12s;
}
.pj-subtask-row:hover .pj-subtask-due.is-empty { opacity: 1; }
.pj-subtask-due.is-empty:hover { color: #1e1f21; background: #eceef0; }
@@ -1747,6 +1747,7 @@ img.pj-person-ic { width: 22px; height: 22px; }
.pj-wl-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.pj-wl-item-main small { color: var(--pj-ink-soft); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-wl-item em { flex: none; font-style: normal; font-size: 12px; color: var(--pj-ink-soft); font-variant-numeric: tabular-nums; }
.pj-wl-item em.is-overdue { color: #d1242f; font-weight: 700; } /* 마감 지난 미완료 */
.pj-dash-card-title { font-size: 13.5px; font-weight: 700; color: var(--pj-ink); margin-bottom: 18px; }
/* 세로 막대(섹션별/담당자별 공용) */
+11 -3
View File
@@ -1007,11 +1007,12 @@
: await api("DELETE", "/project/api/tasks/" + taskId + "/followers/" + encodeURIComponent(email));
return res.followers || [];
}
// 새로 만든 업무의 협업자 = 만든 사람 + 고른 사람(담당자는 빼고) — 서버 _follow·db.add_followers 와 같은 규칙.
// 새로 만든 세부 업무의 협업자 = 고른 사람만(담당자는 빼고) — 서버 _follow·db.add_followers 와 같은 규칙.
// 만든 사람은 세부 업무에 자동으로 협업자가 되지 않는다(2026-10-14).
function newTaskFollowers(chosen, assignee) {
const who = String(assignee || "").toLowerCase();
const out = [];
[pageMeEmail()].concat(chosen || []).forEach(function (x) {
(chosen || []).forEach(function (x) {
x = String(x || "").toLowerCase(); if (x && x !== who && out.indexOf(x) < 0) out.push(x);
});
return out;
@@ -6528,7 +6529,14 @@
btn.querySelector(".pj-wl-item-title").textContent = t.title || "(제목 없음)";
const parent = isSub && (seenTask(t.parent_task_id) || (t.parent_title ? { title: t.parent_title } : null));
btn.querySelector("small").textContent = parent ? "상위: " + (parent.title || "") : (t.stage_name || "");
btn.querySelector("em").textContent = t.due_date ? fmtShortDate(t.due_date) : "";
// 마감일 = mm/dd(요일), 지난 마감(미완료)은 빨간 굵은 글씨(2026-10-14)
const due = String(t.due_date || "").slice(0, 10);
const em = btn.querySelector("em");
if (/^\d{4}-\d{2}-\d{2}$/.test(due)) {
const dd = new Date(due + "T00:00:00");
em.textContent = due.slice(5, 7) + "/" + due.slice(8, 10) + "(" + ["일", "월", "화", "수", "목", "금", "토"][dd.getDay()] + ")";
if (!(t.completed_at || t.done) && due < isoToday()) { em.classList.add("is-overdue"); em.title = "마감 지남"; }
}
btn.addEventListener("click", function () {
body.querySelectorAll(".pj-wl-item.is-current").forEach(function (b) { b.classList.remove("is-current"); });
btn.classList.add("is-current");
+5 -1
View File
@@ -342,7 +342,11 @@
- **탭**(2026-10-13): 왼쪽 위 큰 탭 둘 — [매출 실적](검정, `/performance/`) · [광고비](주황, `/performance/ads`) — 아이콘 + 고른 탭 색으로 구분,
설정은 맨 오른쪽 톱니 아이콘(프로젝트 모듈과 같은 Material Symbols `settings`, `/performance/settings`). `_tabs.html`.
- **광고비** `/performance/ads?period=…`(기본 이번달) — 매출 실적과 같은 기간 이동(오늘/이번주/이번달/올해/직접선택)·표(일자 × 채널,
연간은 월)·일별 추이·채널 비중·월/연 누적. 채널 = 구글·메타·쿠팡(윙)·쿠팡(로켓)(`ad_spend.CHANNELS`, 앱이 정함).
연간은 월)·일별 추이·채널 비중·월/연 누적. 채널(2026-10-14) = 구글·메타·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰
(`ad_spend.CHANNELS`, 앱이 정함 — 쇼핑몰 채널 코드는 실적 쇼핑몰 코드와 같고 쿠팡(윙)만 `coupang_wing`).
모든 칸 직접 입력 가능, 칸 표시 = **광고비(ROAS%)** — ROAS = 그 칸 기간의 매출 실적 총매출 ÷ 광고비 × 100(정수 반올림,
`ad_spend.roas`). 매출 쇼핑몰 = `ROAS_SALES_CODE`(같은 쇼핑몰, 쿠팡(윙) = `coupang`, **구글·메타 = 카페24 자체몰**),
합계 열·월/연 누적 = 매출 실적에 들어가는 쇼핑몰 전체 매출. 광고비가 없는 칸은 ROAS 없음. 광고비를 고치면 옛 ROAS 는 지우고 새로고침 때 다시 계산.
KPI: 기간 광고비(전기간 대비), 매출 대비 광고비(같은 기간 광고비 ÷ 매출 실적 총매출), 월·연 누적.
저장 `perf_ad_spend`(마이그레이션 005 — 채널 × 날짜 하나에 금액, `source` manual/upload/api), 미적용이면 화면에 안내·API 503.
- 날짜 칸을 눌러 직접 입력(`PUT /api/ad-spend/{channel}/{day}`, 비우면 지움, 오늘까지) — 파란 숫자. 매출 수동 입력과 같은 JS(`MANUAL_API`).
+9
View File
@@ -1326,6 +1326,15 @@ Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Frame
- 검증: `tests/test_project_module.py::test_assignee_is_never_follower`(실제 PG, 028 두 번 실행 포함),
`tests/test_project_review_fixes.py`(같은 트랜잭션에서 협업자 정리), `tests/js/project_ui.test.js` [내 업무 창](`render_project.py` 가 `mytasks_render.html` 도 만든다).
## 6-20. 세부 업무 자동 협업자 없음 · 마감일 아이콘 옅게 · 담당자별 패널 날짜 (2026-10-14)
- **세부 업무를 만들 때 만든 사람을 자동 협업자로 넣지 않는다** — 만들 때 고른 협업자만(`_create_task_for`: `parent_task_id`
가 있으면 `_follow` 에 만든 사람을 빼고 고른 사람만). 담당자도 자동 지정되지 않는다(세부 업무는 섹션이 없어 기본 담당자 없음).
메인 업무는 그대로 만든 사람 자동 협업자. 화면 `newTaskFollowers` 도 같은 규칙(고른 사람만). 이미 만든 세부 업무의 협업자는 그대로.
- **업무 창 세부 업무 줄 마감일 아이콘** — 마감일이 없을 때 점선 원 달력 아이콘을 협업자 아이콘처럼 늘 옅게(`opacity .5`, 줄 hover = 진하게).
- **대시보드 담당자별 합계 → 오른쪽 업무 목록 패널** — 오른쪽 날짜 `mm/dd(요일)`(예: 10/07(수)), 마감이 지난 미완료 업무는 빨간 굵은 글씨(`em.is-overdue`).
- 검증: `test_create_with_followers_and_my_overdue`(세부 = 고른 사람만, 메인 = 만든 사람), `project_ui.test.js` [대시보드 담당자별] 패널 날짜.
## 7. 추후 단계
작업 라벨(태그 분류) · 반복 작업 · 템플릿 · 작업 의존성.
+13 -2
View File
@@ -144,13 +144,24 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
const e = await env("perf_ads.html");
check("[광고비] 광고비 탭이 고른 탭", e.d.querySelector(".perf-tab-ads").classList.contains("is-active"));
const heads = Array.from(e.d.querySelectorAll(".perf-main thead th")).map(function (th) { return th.textContent.replace("✎", "").trim(); });
check("[광고비] 열 = 구글·메타·쿠팡(윙)·쿠팡(로켓)", heads.join(",") === "날짜,구글,메타,쿠팡(윙),쿠팡(로켓),일 합계", heads);
check("[광고비] 열 = 구글·메타·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰",
heads.join(",") === "날짜,구글,메타,네이버,쿠팡(윙),쿠팡(로켓),오늘의집,G마켓,카카오,GS샵,11번가,롯데ON,토스,애터미아자몰,일 합계", heads);
const wing = cell(e, "coupang_wing", "2026-10-05");
check("[광고비] 칸 = 광고비(ROAS%) — 쿠팡(윙) 29,000 · 쿠팡 매출 87,000 → 300%",
wing.textContent.trim() === "29,000(300%)" && !cell(e, "naver", "2026-10-05").querySelector(".perf-roas"), wing.textContent);
const up = cell(e, "coupang_rocket", "2026-10-01"), man = cell(e, "google", "2026-10-02");
check("[광고비] 업로드 값 = 주황(is-upload), 직접 입력 = 파랑(is-manual)", up.classList.contains("is-upload") &&
!up.classList.contains("is-manual") && man.classList.contains("is-manual") && gross(up) === "220,000");
check("[광고비] 앞으로의 날은 입력 칸 아님", !cell(e, "google", "2026-10-08") && !!cell(e, "google", "2026-10-07"));
const kpi = Array.from(e.d.querySelectorAll(".perf-kpi-value")).map(function (n) { return n.textContent.trim(); });
check("[광고비] KPI — 이번달 광고비 270,000 · 매출 대비 비율", kpi[0] === "₩270,000" && /%$/.test(kpi[1]), kpi);
check("[광고비] KPI — 이번달 광고비 299,000 · 매출 대비 비율", kpi[0] === "₩299,000" && /%$/.test(kpi[1]), kpi);
wing.click();
const wi = wing.querySelector(".perf-manual-input");
wi.value = "30000";
wi.dispatchEvent(new e.w.FocusEvent("blur"));
await settle();
check("[광고비] 광고비를 고치면 옛 ROAS 는 지움(새로고침 때 다시 계산)", gross(wing) === "30,000" && !wing.querySelector(".perf-roas"));
e.calls.length = 0;
check("[광고비] 매출 실적의 수수료 전환 없음", !e.d.querySelector(".perf-metric") && e.d.getElementById("perf-dash").dataset.metric === "gross");
const td = cell(e, "meta", "2026-10-03");
td.click();
+8
View File
@@ -736,6 +736,14 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
}), env.d.querySelector(".pj-wl-name") && env.d.querySelector(".pj-wl-name").innerHTML);
const sum = env.d.querySelector(".pj-wl-sum").textContent.replace(/\s+/g, " ");
check("[대시보드 담당자별] 전체 완료 2/6 (33%)", /2 \/ 6 \(33%\)/.test(sum), sum);
// 패널 날짜 = mm/dd(요일), 마감 지난 미완료만 빨간 굵은 글씨(2026-10-14)
P.state().tasks.forEach(function (t) {
if (t.id === 101) t.due_date = "2026-09-01"; // 완료 — 지나도 보통 글씨
if (t.id === 102) t.due_date = "2026-09-01"; // 미완료 — 지남(화요일)
});
env.d.querySelectorAll(".pj-wl-group")[0].querySelector(".pj-wl-col:not(.is-sub)").click(); await settle();
const ems = Array.from(env.d.body.querySelectorAll(".pj-wl-drawer .pj-wl-item em")).map(function (m) { return m.textContent + (m.classList.contains("is-overdue") ? "!" : ""); });
check("[대시보드 담당자별] 패널 날짜 mm/dd(요일) + 지난 미완료만 빨강", JSON.stringify(ems) === JSON.stringify(["09/01(화)!", "09/01(화)"]), ems);
// 막대 → 오른쪽 패널(body 에) → 항목 → 편집 창
env.d.querySelectorAll(".pj-wl-group")[1].querySelector(".pj-wl-col.is-sub").click(); await settle();
const drawer = env.d.body.querySelector(".pj-wl-drawer");
+2 -1
View File
@@ -58,7 +58,8 @@ class FakeStore:
return []
def ad_amounts(self, start, end):
rows = {(date(2026, 10, 1), "coupang_rocket"): (220000, "upload"), (date(2026, 10, 2), "google"): (50000, "manual")}
rows = {(date(2026, 10, 1), "coupang_rocket"): (220000, "upload"), (date(2026, 10, 2), "google"): (50000, "manual"),
(date(2026, 10, 5), "coupang_wing"): (29000, "manual")}
rows = {k: v for k, v in rows.items() if start <= k[0] <= end}
return {k: v[0] for k, v in rows.items()}, {k: v[1] for k, v in rows.items()}
+6 -1
View File
@@ -1395,7 +1395,12 @@ def test_create_with_followers_and_my_overdue():
url = f"/project/api/projects/{p['id']}/tasks"
r = req("POST", url, ALICE, json={"title": "세부-협업", "parent_task_id": t["id"], "followers": [BOB, BOB.upper()]})
assert r.status_code == 201
assert sorted(ST.list_followers(task_id=r.json()["task"]["id"])) == sorted([ALICE, BOB])
# 세부 업무는 만든 사람(ALICE)을 자동 협업자로 넣지 않는다 — 고른 사람만(2026-10-14)
assert ST.list_followers(task_id=r.json()["task"]["id"]) == [BOB]
r0 = req("POST", url, ALICE, json={"title": "세부-빈", "parent_task_id": t["id"], "assignee_email": BOB})
assert r0.status_code == 201 and ST.list_followers(task_id=r0.json()["task"]["id"]) == []
rm = req("POST", url, ALICE, json={"title": "메인", "stage_id": s["id"]}) # 메인 업무는 그대로 만든 사람 자동
assert rm.status_code == 201 and ST.list_followers(task_id=rm.json()["task"]["id"]) == [ALICE]
n_before = _count("SELECT COUNT(*) AS n FROM tasks WHERE parent_task_id=%s", t["id"])
assert req("POST", url, ALICE, json={"title": "x", "parent_task_id": t["id"], "followers": [DAVE]}).status_code == 400
assert req("POST", url, ALICE, json={"title": "x", "parent_task_id": t["id"], "followers": "bob"}).status_code == 400