feat(project): month-bounded meeting weeks, weekly sales targets, sticky header
- Weeks stay inside the month: week 1 starts on the 1st (through the next Sunday if the 1st is a weekend); a trailing Mon/Tue joins the last week. "Last week" is the previous period. - Prev-week review columns: 전주 업무 | 결과(text, new result_note) | 전주 목표 | 결과(amount). - Header now shows month target, cumulative weekly target, month-to-date sales and gap (amount + %), with decisions/notes beside it; the area stays fixed while scrolling. - Goals board: the monthly sales target is entered per week; the sum becomes the month target. - Migration 020: result_note, goal_week_targets, drop Monday-only check, move absorbed Monday meetings to the new week start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ const ROOT = path.join(__dirname, "..", "..");
|
||||
const OUT = path.join(__dirname, ".out");
|
||||
const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8");
|
||||
const PAGE = {};
|
||||
["goals_admin", "goals_ro", "meeting_admin", "meeting_err", "meeting_ro"].forEach(function (n) {
|
||||
["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro"].forEach(function (n) {
|
||||
PAGE[n] = fs.readFileSync(path.join(OUT, n + ".html"), "utf8");
|
||||
});
|
||||
const GOALS_URL = "http://localhost/project/goals/2026";
|
||||
@@ -403,20 +403,45 @@ function meetServer(env, st) {
|
||||
check("[2c] 최종 서버 정량 목표 300 · 지난주 결과(7일 전 주 줄 902) 75", st.items[1].target_amount === 300 && st.items[902].result_amount === 75, st.items);
|
||||
check("[2c] 달성률·평가 열 없음(2026-10-06)", !env.d.querySelector("[data-rate], select.pj-meet-eval"));
|
||||
});
|
||||
await section(async function () { // 금주 목표 저장 — 새로고침하지 않고 숫자 칸만 다시(다른 칸의 미저장 글 보존)
|
||||
await section(async function () { // 지난주 결과 글(020) — 지난 주차 줄(data-prev)에 저장, 새로고침 없음
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
const st = meetServer(env, { itemHook: function (id, body) { if ("content" in body) return { status: 503, body: { detail: "x" } }; } });
|
||||
const st = meetServer(env);
|
||||
await boot(env);
|
||||
const gets0 = st.gets || 0;
|
||||
const ta = env.d.querySelector('tr[data-item="1"] .pj-meet-text');
|
||||
ta.focus(); type(env, ta, "unsaved note");
|
||||
const tgt = env.d.getElementById("pj-meet-target");
|
||||
tgt.focus(); tgt.value = "2,000"; tgt.blur();
|
||||
const note = env.d.querySelector('tr[data-item="2"] .pj-meet-rnote');
|
||||
check("[2d] 결과 글 칸 = 지난 주차 값", !!note && note.value === "샘플 결과", note && note.value);
|
||||
note.focus(); type(env, note, "결과 메모"); note.blur();
|
||||
await settle(); await wait(10); await settle();
|
||||
check("[2d] 금주 목표 저장 = 서버 확정값", st.head.week_target === 2000 && tgt.value === "2,000", st.head);
|
||||
check("[2d] 결과 글 → 지난 주차 줄(902)에 저장", st.items[902] && st.items[902].result_note === "결과 메모", st.items);
|
||||
check("[2d] 페이지 새로고침 없음", env.navigations === 0);
|
||||
check("[2d] 숫자 칸만 다시 받음(GET 1회 더)", (st.gets || 0) === gets0 + 1, st.gets);
|
||||
check("[2d] 다른 칸 미저장 글 유지", ta.value === "unsaved note");
|
||||
check("[2d] 금주 목표 입력칸 없음(위쪽 숫자 4칸)", !env.d.getElementById("pj-meet-target") && env.d.querySelectorAll(".pj-meet-top .pj-meet-kpi").length === 4);
|
||||
});
|
||||
|
||||
// ════════════════════ [2e] 주차별 매출 목표(020) — 매출 목표 칸 → 주차 입력 창(body), 저장하면 합계가 월 목표 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.goals_weekly_admin, GOALS_URL);
|
||||
const st = goalsServer(env);
|
||||
let sent = null;
|
||||
env.route("PUT", /\/project\/api\/goals\/2026\/week-targets\/1$/, function (u, body) {
|
||||
sent = body;
|
||||
const weeks = {};
|
||||
Object.keys(body.weeks).forEach(function (k) { weeks[k] = body.weeks[k]; });
|
||||
return { body: { ok: true, value: 600, label: "600", weeks: weeks } };
|
||||
});
|
||||
await boot(env);
|
||||
const inp = env.d.querySelector('input.pj-goal-num[data-metric="sales"][data-kind="target"][data-month="1"]');
|
||||
check("[2e] 매출 목표 칸은 직접 입력 아님(readonly)", inp.readOnly && inp.dataset.weekly === "1");
|
||||
inp.click();
|
||||
const pop = env.d.body.querySelector(".pj-goal-wkpop");
|
||||
const ins = pop ? Array.from(pop.querySelectorAll("input")) : [];
|
||||
check("[2e] 창은 body 에, 1월 주차 수만큼 입력칸", !!pop && pop.parentElement === env.d.body && ins.length === 5, ins.length);
|
||||
check("[2e] 저장된 주차 값·합계", ins[0].value === "100" && ins[1].value === "200" && pop.querySelector(".pj-goal-wkpop-sum b").textContent === "300");
|
||||
type(env, ins[2], "300");
|
||||
check("[2e] 입력하면 합계 다시 계산", pop.querySelector(".pj-goal-wkpop-sum b").textContent === "600");
|
||||
pop.querySelector('[data-act="save"]').click();
|
||||
await settle(); await wait(10); await settle();
|
||||
check("[2e] 주차별 값 전송(주차 시작일 키)", sent && sent.weeks["2026-01-12"] === "300" && Object.keys(sent.weeks).length === 5, sent);
|
||||
check("[2e] 월 목표 칸 = 합계, 창 닫힘", inp.value === "600" && !env.d.body.querySelector(".pj-goal-wkpop"));
|
||||
check("[2e] 월 목표 직접 저장 요청 없음", !st.metric);
|
||||
});
|
||||
|
||||
// ════════════════════ [3] 목표 표 — 글 저장 실패면 구조 변경·표 교체 중단 ════════════════════
|
||||
@@ -504,12 +529,11 @@ function meetServer(env, st) {
|
||||
const kpi = Array.from(env.d.querySelectorAll(".pj-meet-kpi")).map(function (k) { return k.textContent.replace(/\s+/g, " ").trim(); });
|
||||
const mtd = kpi.find(function (t) { return /월 누적 실적/.test(t); });
|
||||
check("[6] 월 누적 = 미확인(0원 아님)", /미확인/.test(mtd) && !/0원|0 원/.test(mtd), mtd);
|
||||
check("[6] 주당 필요 = 미확인(목표로 계산하지 않음)", /미확인/.test(kpi.find(function (t) { return /주당 필요/.test(t); })));
|
||||
check("[6] 전주 결과·금주 실적 = 미확인", /미확인/.test(kpi.find(function (t) { return /전주 결과/.test(t); })) && /미확인/.test(kpi.find(function (t) { return /금주 현재 실적/.test(t); })));
|
||||
check("[6] 누적 목표 대비 달성 = 미확인(차액·% 계산하지 않음)", /미확인/.test(kpi.find(function (t) { return /누적 목표 대비/.test(t); })));
|
||||
const row = env.d.querySelector('tr[data-item="1"]');
|
||||
check("[6] 쇼핑몰 줄도 결과 = 직접 입력 칸(자동 결과 폐지)", !!row.querySelector(".pj-meet-c-result input") && !/미확인/.test(row.querySelector(".pj-meet-c-result").textContent));
|
||||
check("[6] 줄별 이번주 실적 표시 없음 · 달성률 열 없음", !row.querySelector(".pj-meet-week-slot") && !row.querySelector("[data-rate]"));
|
||||
check("[6] 회의록 입력은 그대로 가능", !!row.querySelector(".pj-meet-text") && !!env.d.getElementById("pj-meet-target"));
|
||||
check("[6] 회의록 입력은 그대로 가능", !!row.querySelector(".pj-meet-text") && !!env.d.getElementById("pj-meet-notes"));
|
||||
check("[6] 조회 실패 안내 문구", /미확인/.test(env.d.querySelector(".pj-meet-perf-warn").textContent));
|
||||
});
|
||||
await section(async function () { // 지난주 리뷰 머리 = 지난주(9/21~) — 지난주 회의록에 없는 줄 안내
|
||||
@@ -802,7 +826,7 @@ function meetServer(env, st) {
|
||||
await wait(20); await settle();
|
||||
check("[9] 실적 권한 없음 → sync API 호출 0", !st.syncCalls && !env.calls.some(function (c) { return /performance/.test(c.url); }));
|
||||
check("[9] 권한 없음 설명(저장된 실적·마지막 갱신 시각)", /권한이 없어/.test(env.d.getElementById("pj-meet-sync").textContent) && /10\/01 14:20/.test(env.d.getElementById("pj-meet-sync").textContent));
|
||||
check("[9] 보기 전용: 입력칸 없음", !env.d.querySelector(".pj-meet-text") && !env.d.getElementById("pj-meet-target"));
|
||||
check("[9] 보기 전용: 입력칸 없음", !env.d.querySelector(".pj-meet-text, .pj-meet-rnote, #pj-meet-notes"));
|
||||
});
|
||||
await section(async function () { // 10분 제한 — 최근 기록이 있으면 다시 부르지 않고 그 상태만(일부 실패면 안내 유지)
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL, { session: { "pj_meet_sync:2026-09-28": JSON.stringify({ at: Date.now(), state: "partial", bad: ["네이버"] }) } });
|
||||
|
||||
@@ -40,7 +40,7 @@ assert.equal(w.lastScroll, "goals-merge");
|
||||
assert.equal(d.querySelector('.pjh-toc [aria-current="location"]').hash, "#goals");
|
||||
assert.equal(new URL(w.location.href).searchParams.get("q"), "셀 병합");
|
||||
|
||||
search("7일 전");
|
||||
search("바로 앞 주차");
|
||||
assert.ok(links().some(a => a.hash === "#meetings-review"), "제목에 없는 본문 단어도 검색");
|
||||
search("매출 갱신");
|
||||
assert.equal(links()[0].hash, "#meetings-markets");
|
||||
|
||||
@@ -55,13 +55,23 @@ def goals_ctx(admin: bool) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def week_targets() -> dict:
|
||||
"""2026년 달마다 주차(store.month_weeks) — 1월 1·2주차만 값(100·200)."""
|
||||
out = {}
|
||||
for mo in range(1, 13):
|
||||
out[mo] = [{"start": a.isoformat(), "n": i + 1, "label": f"{a.month}/{a.day}~{b.month}/{b.day}",
|
||||
"value": {(1, 0): "100", (1, 1): "200"}.get((mo, i), "")}
|
||||
for i, (a, b) in enumerate(store.month_weeks(2026, mo))]
|
||||
return out
|
||||
|
||||
|
||||
def meeting_view(err: bool) -> dict:
|
||||
"""회의록 2026-09-28 주 — 유통 쿠팡(쇼핑몰 연결 — 화면엔 자동 실적 없음, 정량 목표 100), 상품1(직접 입력 결과)."""
|
||||
prev_cou = {"id": 901, "week_start": "2026-09-21", "content": "지난주 행사", "target_amount": 100, "result_amount": None,
|
||||
"status": "", "marketplace_code": "coupang", "period": "9/21~9/27", "not_started": False,
|
||||
"market_off": False, "auto_error": err, "auto_result": None if err else 80,
|
||||
"result": None if err else 80, "market_name": "쿠팡"}
|
||||
prev_p1 = {"id": 902, "week_start": "2026-09-21", "content": "샘플", "target_amount": 200, "result_amount": 100,
|
||||
prev_p1 = {"id": 902, "week_start": "2026-09-21", "content": "샘플", "result_note": "샘플 결과", "target_amount": 200, "result_amount": 100,
|
||||
"status": "partial", "marketplace_code": "", "period": "9/21~9/27", "not_started": False,
|
||||
"market_off": False, "auto_error": False, "auto_result": None, "result": 100, "market_name": ""}
|
||||
it_cou = {"id": 1, "section": "유통", "section_color": "", "label": "쿠팡", "content": "original",
|
||||
@@ -74,7 +84,7 @@ def meeting_view(err: bool) -> dict:
|
||||
it_new = {"id": 3, "section": "상품", "section_color": "#fde2e4", "label": "새 줄", "content": "",
|
||||
"target_amount": None, "marketplace_code": "", "market_name": "", "market_off": False,
|
||||
"market_unknown": False, "week_auto": None, "week_error": False, "prev": None, "rate": None}
|
||||
meeting = {"week_start": "2026-09-28", "week_target": 1000, "attendees": "", "notes": "메모 원본", "cell_merges": True,
|
||||
meeting = {"week_start": "2026-09-28", "week_target": 1000, "attendees": "", "notes": "메모 원본", "cell_merges": True, "result_notes": True,
|
||||
"items": [it_p1, it_new, it_cou],
|
||||
"sections": [{"name": "상품", "color": "#fde2e4", "rows": [it_p1, it_new]},
|
||||
{"name": "유통", "color": "", "rows": [it_cou]}]}
|
||||
@@ -82,6 +92,8 @@ def meeting_view(err: bool) -> dict:
|
||||
"mtd": None if err else 0, "mtd_end": "2026-09-27", "weeks_left": 1,
|
||||
"need_per_week": None if err else 10000, "prev_target": 500, "prev_exists": True,
|
||||
"prev_result": None if err else 0, "week_result": None if err else 0,
|
||||
"week_targets_set": True, "cum_target": 4000.0, "cum_target_won": 4000,
|
||||
"gap": None if err else -4000, "rate": None if err else 0.0,
|
||||
"perf": True, "perf_state": "error" if err else "ok",
|
||||
"unknown": ["mtd", "prev_result", "week_result"] if err else [],
|
||||
"fresh_oldest": "" if err else "10/01 14:20",
|
||||
@@ -139,6 +151,8 @@ def main() -> None:
|
||||
pages = {
|
||||
"goals_admin.html": ("project/goals.html", goals_ctx(True)),
|
||||
"goals_ro.html": ("project/goals.html", goals_ctx(False)),
|
||||
# 주차별 매출 목표(020) — 매출 목표 칸이 주차 입력 창을 연다
|
||||
"goals_weekly_admin.html": ("project/goals.html", goals_ctx(True) | {"week_targets": week_targets()}),
|
||||
"meeting_admin.html": ("project/goal_meeting.html", meeting_ctx(True, False)),
|
||||
"meeting_err.html": ("project/goal_meeting.html", meeting_ctx(True, True)),
|
||||
"meeting_ro.html": ("project/goal_meeting.html", meeting_ctx(False, False, can_sync=False)),
|
||||
|
||||
Reference in New Issue
Block a user