feat(project): allow text in meeting target/result cells; fix result note save
- Target and result cells accept text such as "20개". Values that parse
as amounts still go to the integer columns; anything else goes to the
new target_text/result_text columns (migration 021).
- Fix: PUT /api/goals/meeting-items/{id} dropped result_note, so the
last-week result text was never saved.
- Update meeting nav test to the month-bounded week numbering.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2536,7 +2536,17 @@ class ProjectStore:
|
||||
def _meeting_cols(self, conn: Any) -> str:
|
||||
return (self._MEETING_ITEM_COLS + (", line_key" if self._meeting_keys(conn) else "")
|
||||
+ (", content_row_span" if self._meeting_cells(conn) else "")
|
||||
+ (", result_note" if self._meeting_v20(conn) else ""))
|
||||
+ (", result_note" if self._meeting_v20(conn) else "")
|
||||
+ (", target_text, result_text" if self._meeting_v21(conn) else ""))
|
||||
|
||||
def _meeting_v21(self, conn: Any) -> bool:
|
||||
"""마이그레이션 021 — 정량 목표·결과 글(target_text·result_text, 예: "20개")."""
|
||||
if getattr(self, "_meeting_v21_ok", False):
|
||||
return True
|
||||
ok = self._column_exists(conn, "goal_meeting_items", "target_text")
|
||||
if ok:
|
||||
self._meeting_v21_ok = True
|
||||
return ok
|
||||
|
||||
def _meeting_v20(self, conn: Any) -> bool:
|
||||
"""마이그레이션 020 — 결과 글 칸(result_note)·월요일이 아닌 주차 시작일·주차별 목표(goal_week_targets)."""
|
||||
@@ -2845,13 +2855,20 @@ class ProjectStore:
|
||||
if "content" in fields:
|
||||
sets.append("content = %s")
|
||||
params.append(store.validate_meeting_content(fields["content"]))
|
||||
# 정량 목표·결과 — 숫자로 읽히면(1,200,000 · 120만) 원 정수 칸, 아니면(예: "20개") 글 칸(021). 둘 중 하나만 채운다.
|
||||
texts: list[tuple[str, str, str]] = [] # (글 칸, 글, 021 이 없을 때 낼 오류)
|
||||
for k in ("target_amount", "result_amount"):
|
||||
if k in fields:
|
||||
v = store.validate_meeting_amount(fields[k])
|
||||
try:
|
||||
v, text, err = store.validate_meeting_amount(fields[k]), "", ""
|
||||
except ValueError as exc:
|
||||
v, err = None, str(exc)
|
||||
text = store.validate_meeting_text(fields[k], limit=store.MEETING_AMOUNT_TEXT_MAX, what="정량 목표·결과")
|
||||
if k == "target_amount" and v is not None and v < 0:
|
||||
raise ValueError("목표 금액은 0 이상이어야 합니다.")
|
||||
sets.append(f"{k} = %s")
|
||||
params.append(v)
|
||||
texts.append((k.replace("_amount", "_text"), text, err))
|
||||
if "status" in fields:
|
||||
sets.append("status = %s")
|
||||
params.append(store.validate_meeting_status(fields["status"]))
|
||||
@@ -2869,6 +2886,12 @@ class ProjectStore:
|
||||
self._require_meetings(conn)
|
||||
if "result_note" in fields and not self._meeting_v20(conn):
|
||||
raise store.MeetingMigration020Needed()
|
||||
if self._meeting_v21(conn):
|
||||
for col, text, _err in texts:
|
||||
sets.append(f"{col} = %s")
|
||||
params.append(text)
|
||||
elif any(text for _c, text, _e in texts):
|
||||
raise ValueError(next(e for _c, t, e in texts if t)) # 021 전 — 예전처럼 숫자만
|
||||
rows = self._locked_meeting_items(conn, item_id)
|
||||
if "content" in fields:
|
||||
self._require_meeting_cell_visible(rows, item_id)
|
||||
|
||||
@@ -3297,11 +3297,11 @@ def api_add_meeting_item(request: Request, week_start: str, payload: dict[str, A
|
||||
|
||||
@router.put("/api/goals/meeting-items/{item_id}")
|
||||
def api_update_meeting_item(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""줄 칸 하나 — label·content·target_amount·result_amount·status·marketplace_code. 전주 결과·평가는
|
||||
이번 회의 화면에서 지난주 줄(prev)의 result_amount·status 로 저장한다."""
|
||||
"""줄 칸 하나 — label·content·target_amount·result_amount(숫자 아니면 글 — 021)·result_note(020)·status·marketplace_code.
|
||||
지난주 결과(글·금액)는 이번 회의 화면에서 지난 주차 줄(prev)에 저장한다."""
|
||||
user = _require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
keys = ("label", "content", "target_amount", "result_amount", "status", "marketplace_code")
|
||||
keys = ("label", "content", "target_amount", "result_amount", "result_note", "status", "marketplace_code")
|
||||
item = _goal_call(st.update_meeting_item, item_id=item_id,
|
||||
fields={k: payload[k] for k in keys if k in payload}, updated_by=user["email"])
|
||||
return JSONResponse({"ok": True, "item": item})
|
||||
|
||||
@@ -631,6 +631,7 @@ def validate_goal_rect_cols(col_from: Any, col_to: Any) -> tuple[int, int]:
|
||||
MEETING_STATUS: dict[str, str] = {"": "", "done": "완료", "partial": "일부", "miss": "미달"}
|
||||
MEETING_TEXT_MAX = 4000
|
||||
MEETING_LABEL_MAX = 50
|
||||
MEETING_AMOUNT_TEXT_MAX = 100 # 정량 목표·결과 글(021, 예: "20개")
|
||||
# 첫 회의록(이전 주 회의록이 없을 때)의 구역별 줄 — 사용자 회의록 양식(2026-10). 목표 표의 업무 영역 이름과 같으면
|
||||
# 그 줄들로, 없는 구역은 빈 줄 하나. 다음 주부터는 지난주 회의록 줄을 그대로 이어받는다.
|
||||
MEETING_TEMPLATE: dict[str, tuple[str, ...]] = {
|
||||
|
||||
@@ -215,8 +215,9 @@
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="pj-meet-c-amt">
|
||||
{% if edit %}<input type="text" class="pj-meet-amount" data-field="target_amount" inputmode="decimal" autocomplete="off" value="{{ won(it.target_amount) }}" />
|
||||
{% else %}{{ won(it.target_amount) }}{% endif %}
|
||||
{# 숫자(원, 120만·1.5억도) 또는 글(예: 20개 — 021 target_text) #}
|
||||
{% if edit %}<input type="text" class="pj-meet-amount" data-field="target_amount" autocomplete="off" value="{{ it.target_text or won(it.target_amount) }}" />
|
||||
{% else %}{{ it.target_text or won(it.target_amount) }}{% endif %}
|
||||
</td>
|
||||
{% if p %}
|
||||
<td class="pj-meet-c-text is-prev"><div class="pj-meet-ro">{% if p.content_html is defined %}{{ p.content_html | safe }}{% else %}{{ p.content }}{% endif %}</div></td>
|
||||
@@ -225,10 +226,10 @@
|
||||
{% if edit and meeting.result_notes %}<textarea class="pj-meet-rnote" rows="1" data-field="result_note" data-target="prev" aria-label="{{ it.label }} 결과" placeholder="결과">{{ p.result_note or '' }}</textarea>
|
||||
{% else %}<div class="pj-meet-ro">{{ p.result_note or '' }}</div>{% endif %}
|
||||
</td>
|
||||
<td class="pj-meet-c-amt is-prev">{{ won(p.target_amount) }}</td>
|
||||
<td class="pj-meet-c-amt is-prev">{{ p.target_text or won(p.target_amount) }}</td>
|
||||
<td class="pj-meet-c-amt is-prev pj-meet-c-result">
|
||||
{% if edit %}<input type="text" class="pj-meet-amount" data-field="result_amount" data-target="prev" inputmode="decimal" autocomplete="off" value="{{ won(p.result_amount) }}" placeholder="결과" />
|
||||
{% else %}{{ won(p.result_amount) }}{% endif %}
|
||||
{% if edit %}<input type="text" class="pj-meet-amount" data-field="result_amount" data-target="prev" autocomplete="off" value="{{ p.result_text or won(p.result_amount) }}" placeholder="결과" />
|
||||
{% else %}{{ p.result_text or won(p.result_amount) }}{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="pj-meet-c-text is-prev is-none" colspan="4"><span class="pj-muted">{% if h.prev_exists %}지난주 회의록에 없는 줄{% else %}지난주({{ prev_week[5:] | replace('-', '/') }}~) 회의록 없음{% endif %}</span></td>
|
||||
@@ -247,7 +248,7 @@
|
||||
<div class="pj-goal-foot">
|
||||
<button type="button" class="pj-btn" id="pj-meet-sec-new">+ 구역 추가</button>
|
||||
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 금액은 원 단위(120만·1.5억도 됨). 항목을 우클릭하거나 ⋯ 를 누르면
|
||||
줄 추가·순서·삭제. 지난주 결과(글·금액)는 지난 주차 회의록 줄에 저장됩니다.</span>
|
||||
줄 추가·순서·삭제. 정량 목표·결과는 숫자나 글(예: 20개) 모두 됩니다. 지난주 결과는 지난 주차 회의록 줄에 저장됩니다.</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -262,5 +263,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261003b" defer></script>
|
||||
<script src="/static/project.js?v=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% 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=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -611,12 +611,12 @@
|
||||
|
||||
<h3 id="meetings-edit">주요 업무·정량 목표·참석자·메모 입력</h3>
|
||||
<ol class="pjh-steps">
|
||||
<li>줄별 <b>정량 목표</b>에 각 항목의 이번 주차 목표 금액을 원 단위로 적습니다. 전체 매출 목표는 연간 목표 표의 주차별 목표에서 정합니다.</li>
|
||||
<li>줄별 <b>정량 목표</b>에 각 항목의 이번 주차 목표를 적습니다. 금액(원 단위)뿐 아니라 <code>20개</code>처럼 글도 됩니다. 전체 매출 목표는 연간 목표 표의 주차별 목표에서 정합니다.</li>
|
||||
<li>각 항목의 <b>주요 업무</b>에 실행할 일과 일정을 적습니다.</li>
|
||||
<li><span class="pjh-ui">참석자</span>를 눌러 프로젝트 관리 권한이 있는 등록 직원 중 선택합니다. 찾기·전원 선택·모두 해제를 사용할 수 있으며, 칩의 <span class="pjh-ui">×</span>로 참석자를 뺍니다.</li>
|
||||
<li>위쪽 오른쪽 <b>결정 사항 · 메모</b>에 회의 결론과 다음주까지 확인할 일을 적습니다.</li>
|
||||
</ol>
|
||||
<p>금액은 <code>1,200,000</code>·<code>120만</code>·<code>1.5억</code>·<code>3천만</code>·<code>1억2천만</code>처럼 입력할 수 있습니다. <kbd>Enter</kbd> 또는 칸을 떠날 때 원 단위로 저장되고, 빈칸은 값을 지웁니다. 글·메모는 입력을 약 0.8초 멈추거나 칸을 떠날 때, 참석자는 바꾸는 즉시 저장됩니다.</p>
|
||||
<p>금액은 <code>1,200,000</code>·<code>120만</code>·<code>1.5억</code>·<code>3천만</code>·<code>1억2천만</code>처럼 입력할 수 있습니다. <kbd>Enter</kbd> 또는 칸을 떠날 때 원 단위로 저장되고, 빈칸은 값을 지웁니다. 숫자로 읽히지 않는 값(예: <code>20개</code>)은 적은 글 그대로 저장됩니다. 글·메모는 입력을 약 0.8초 멈추거나 칸을 떠날 때, 참석자는 바꾸는 즉시 저장됩니다.</p>
|
||||
|
||||
<p>목표·주간 회의록 표에서 입력한 글·숫자·이름이 칸보다 길면 열 너비가 자동으로 늘어납니다. 글 셀에서는 <kbd>Enter</kbd>를 한 번 누르면 바로 다음 줄로 이동합니다. 지운 뒤 너비를 줄이려면 열 너비 자동 맞춤을 사용하세요.</p>
|
||||
<p>주요 업무 셀에서는 목표 표의 셀 편집 도구를 함께 사용할 수 있습니다.</p>
|
||||
@@ -635,7 +635,7 @@
|
||||
<li><b>전주 업무</b> — 지난 주차에 적은 주요 업무를 그대로 보여 줍니다(읽기 전용).</li>
|
||||
<li><b>결과</b>(글) — 지난 주차 업무를 어떻게 했는지 관리자가 적습니다.</li>
|
||||
<li><b>전주 목표</b> — 지난 주차 회의록에서 그 줄에 적은 정량 목표입니다.</li>
|
||||
<li><b>결과</b>(금액) — 관리자가 지난 주차 결과 금액을 직접 입력합니다(실적 모듈에서 자동 입력되지 않습니다).</li>
|
||||
<li><b>결과</b>(오른쪽 끝) — 관리자가 지난 주차 결과를 직접 입력합니다. 금액도, <code>18개</code> 같은 글도 됩니다(실적 모듈에서 자동 입력되지 않습니다).</li>
|
||||
<li><b>저장 위치</b> — 이번 화면에서 입력한 지난주 결과(글·금액)는 <b>지난 주차 회의록의 줄</b>에 저장됩니다. 주요 업무·정량 목표는 이번 주차 회의록에 저장됩니다.</li>
|
||||
<li><span class="pjh-ui">순서 바꾸기</span>는 이번주와 지난주 리뷰의 좌우 배치만 바꿉니다. 선택은 로그인한 사람별로 내 브라우저에 기억됩니다.</li>
|
||||
</ul>
|
||||
|
||||
@@ -104,5 +104,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -492,5 +492,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007b" defer></script>
|
||||
<script src="/static/project.js?v=20261007c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
+10
-8
@@ -10195,17 +10195,19 @@
|
||||
const cell = inp.closest("td") || inp.closest(".pj-meet-kpi");
|
||||
clearSaveFailed(cell);
|
||||
flashSaved(cell);
|
||||
let confirmed;
|
||||
let shown;
|
||||
if (inp === tgt) {
|
||||
confirmed = res && Object.prototype.hasOwnProperty.call(res, "week_target") ? res.week_target : undefined;
|
||||
meetRepaint().catch(function () {}); // 금주 현재 실적의 "목표의 %"·필요 매출 — 서버 계산으로
|
||||
if (res && Object.prototype.hasOwnProperty.call(res, "week_target")) shown = won(res.week_target);
|
||||
meetRepaint().catch(function () {}); // 머리 숫자 — 서버 계산으로
|
||||
} else {
|
||||
const tr = inp.closest("tr");
|
||||
confirmed = res.item[inp.dataset.field];
|
||||
if (inp.dataset.field === "target_amount") tr.dataset.targetAmount = confirmed == null ? "" : String(confirmed);
|
||||
// 숫자면 원 정수(쉼표 표기), 숫자가 아니면(예: "20개") 서버가 글 칸(target_text·result_text, 021)에 둔 글 그대로
|
||||
const tr = inp.closest("tr"), f = inp.dataset.field, item = res.item;
|
||||
const text = item[f.replace("_amount", "_text")];
|
||||
shown = text ? text : won(item[f]);
|
||||
if (f === "target_amount") tr.dataset.targetAmount = item[f] == null ? "" : String(item[f]);
|
||||
}
|
||||
if (!same || confirmed === undefined) return undefined; // 요청 뒤 새로 입력 중 — 그 초안을 그대로
|
||||
inp.value = won(confirmed);
|
||||
if (!same || shown === undefined) return undefined; // 요청 뒤 새로 입력 중 — 그 초안을 그대로
|
||||
inp.value = shown;
|
||||
return inp.value;
|
||||
},
|
||||
onFail: function (inp, err) { markSaveFailed(inp.closest("td") || inp.closest(".pj-meet-kpi"), err); },
|
||||
|
||||
Reference in New Issue
Block a user