Merge branch 'feat/meeting-section-move'
This commit is contained in:
@@ -3320,6 +3320,29 @@ class ProjectStore:
|
||||
for n, x in enumerate(ids):
|
||||
conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x))
|
||||
|
||||
def move_meeting_section(self, *, item_id: int, direction: int) -> None:
|
||||
"""구역(표 첫 열 "구분") 통째로 한 칸 위/아래 — item_id 가 든 구역 묶음(이어진 같은 구역 줄)과 옆 구역 묶음의
|
||||
자리를 바꾼다. 묶음 안 줄 순서·세로 병합(content_row_span)은 그대로 따라간다. 맨 위/맨 아래면 그대로."""
|
||||
with self._pool.connection() as conn:
|
||||
with conn.transaction():
|
||||
self._require_meetings(conn)
|
||||
rows = self._locked_meeting_items(conn, item_id)
|
||||
ids = [int(r["id"]) for r in rows]
|
||||
blocks: list[list[int]] = [] # 이어진 같은 구역 줄 묶음(화면의 tbody 하나)
|
||||
for i, r in enumerate(rows):
|
||||
if i and r["section"] == rows[i - 1]["section"]:
|
||||
blocks[-1].append(ids[i])
|
||||
else:
|
||||
blocks.append([ids[i]])
|
||||
b = next(n for n, blk in enumerate(blocks) if item_id in blk)
|
||||
j = b + (1 if direction > 0 else -1)
|
||||
if not 0 <= j < len(blocks):
|
||||
return
|
||||
blocks[b], blocks[j] = blocks[j], blocks[b]
|
||||
order = [x for blk in blocks for x in blk]
|
||||
for n, x in enumerate(order):
|
||||
conn.execute("UPDATE goal_meeting_items SET sort_order = %s WHERE id = %s", (n, x))
|
||||
|
||||
def goal_month_targets(self, *, year: int, month: int) -> dict[str, Any]:
|
||||
"""회의록 머리 — 그 달 매출 목표·실적, 로아스 목표(목표 표 숫자), 매출 단위. 목표 표가 없으면 빈 값."""
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
@@ -3737,3 +3737,19 @@ def api_move_meeting_item(request: Request, item_id: int, payload: dict[str, Any
|
||||
st = _db_or_503(request)
|
||||
_goal_call(st.move_meeting_item, item_id=item_id, direction=int(payload.get("direction") or 0))
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/meeting-items/{item_id}/move-section")
|
||||
def api_move_meeting_section(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""구역(첫 열 "구분") 통째로 위/아래 {direction: -1|1} — item_id = 그 구역의 아무 줄. 줄 순서와 같은 권한(누구나,
|
||||
회의 완료 전까지). 다음 회의록은 이 순서를 이어받는다."""
|
||||
_require_user(request)
|
||||
st = _db_or_503(request)
|
||||
try:
|
||||
direction = int(payload.get("direction") or 0)
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="direction 이 올바르지 않습니다.")
|
||||
if direction not in (-1, 1):
|
||||
raise HTTPException(status_code=400, detail="direction 은 -1(위) 또는 1(아래)입니다.")
|
||||
_goal_call(st.move_meeting_section, item_id=item_id, direction=direction)
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
@@ -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=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -227,7 +227,8 @@
|
||||
<tr data-item="{{ it.id }}" data-section="{{ sec.name }}" data-market="{{ it.marketplace_code }}" data-target-amount="{{ it.target_amount if it.target_amount is not none else '' }}"{% if p %} data-prev="{{ p.id }}" data-prev-target="{{ p.target_amount if p.target_amount is not none else '' }}"{% endif %}>
|
||||
{% if loop.first %}
|
||||
<th class="pj-meet-c-sec" rowspan="{{ sec.rows | length }}">{{ sec.name }}
|
||||
{% if edit %}<button type="button" class="pj-meet-sec-add" data-meet-act="sec-add" title="{{ sec.name }} 구역 끝에 줄 추가">+</button>{% endif %}
|
||||
{% if edit %}<button type="button" class="pj-icon-btn pj-meet-more pj-meet-sec-more" data-meet-act="sec-menu" title="구역 메뉴(위로·아래로) · 우클릭도 됩니다"><span class="material-symbols-outlined">more_horiz</span></button>
|
||||
<button type="button" class="pj-meet-sec-add" data-meet-act="sec-add" title="{{ sec.name }} 구역 끝에 줄 추가">+</button>{% endif %}
|
||||
</th>
|
||||
{% endif %}
|
||||
<th class="pj-meet-c-label">
|
||||
@@ -291,5 +292,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261007a" defer></script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<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=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
@@ -697,6 +697,7 @@
|
||||
<ul>
|
||||
<li>구역 이름 옆 <span class="pjh-ui">+</span>는 그 구역 끝에 줄을 추가합니다. 표 아래 <span class="pjh-ui">+ 구역 추가</span>로 새 구역을 만듭니다.</li>
|
||||
<li>항목 이름을 클릭하면 그 자리에서 고칩니다. 우클릭 또는 ⋯ 메뉴에서 <span class="pjh-ui">위에 줄 추가 · 아래에 줄 추가 · 위로 · 아래로 · 줄 삭제</span>를 사용합니다. 순서 이동은 같은 구역 안에서 합니다.</li>
|
||||
<li><b>구역 순서</b> — 첫 열 <b>구분</b> 칸을 우클릭하거나 마우스를 올려 나오는 <span class="pjh-ui">⋯</span>를 누르면 <span class="pjh-ui">구역 위로 · 구역 아래로 · 구역 끝에 줄 추가</span>가 나옵니다. 구역 안의 줄 순서·병합은 그대로 함께 옮겨지고, 다음에 만드는 회의록도 바뀐 순서를 이어받습니다(회의 완료 전까지, 누구나).</li>
|
||||
<li>줄을 삭제하면 주요 업무·정량 목표도 함께 삭제됩니다. 새 줄은 지난주에 이어진 항목이 없으면 지난주 리뷰가 비어 있습니다.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -101,5 +101,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<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=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -488,5 +488,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261012b" />
|
||||
<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=20261012b" defer></script>
|
||||
<script src="/static/project.js?v=20261012c" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2811,6 +2811,8 @@ th.pj-meet-c-label { position: relative; font-weight: 600; color: #3b4048; text-
|
||||
.pj-meet-more { position: absolute; top: 3px; right: 2px; width: 24px; height: 24px; opacity: 0; transition: opacity .12s; }
|
||||
.pj-meet-more .material-symbols-outlined { font-size: 18px; }
|
||||
th.pj-meet-c-label:hover .pj-meet-more, .pj-meet-more:focus { opacity: 1; }
|
||||
/* 구분(구역) 칸 ⋮ — 구역 위로·아래로(줄 메뉴와 같은 모양) */
|
||||
th.pj-meet-c-sec:hover .pj-meet-sec-more { opacity: 1; }
|
||||
textarea.pj-meet-text, textarea.pj-meet-rnote, .pj-meet-notes textarea {
|
||||
display: block; width: 100%; box-sizing: border-box; min-height: 38px; padding: 6px; border: none; background: transparent;
|
||||
font: inherit; line-height: var(--pj-text-leading); color: inherit; resize: none; overflow: hidden;
|
||||
|
||||
+31
-1
@@ -11197,6 +11197,26 @@
|
||||
} },
|
||||
].concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : []));
|
||||
}
|
||||
// ── 구역 메뉴(구분 칸 ⋯ · 우클릭) — 구역을 통째로 위/아래(그 안의 줄 순서·병합은 그대로), 구역 끝에 줄 추가 ──
|
||||
function secMenu(x, y, tbody) {
|
||||
const blocks = Array.prototype.slice.call(table.querySelectorAll("tbody.pj-meet-sec"));
|
||||
const i = blocks.indexOf(tbody);
|
||||
const first = tbody.querySelector("tr[data-item]");
|
||||
if (!first) return;
|
||||
const mv = function (dir) {
|
||||
return function () {
|
||||
run(async function () { await api("POST", itemUrl(first.dataset.item) + "/move-section", { direction: dir }); return true; });
|
||||
};
|
||||
};
|
||||
const items = [];
|
||||
if (i > 0) items.push({ label: "구역 위로", icon: menuIcon("arrow_upward"), onClick: mv(-1) });
|
||||
if (i < blocks.length - 1) items.push({ label: "구역 아래로", icon: menuIcon("arrow_downward"), onClick: mv(1) });
|
||||
if (items.length) items.push(null);
|
||||
items.push({ label: "구역 끝에 줄 추가", icon: menuIcon("add_row_below"), onClick: function () {
|
||||
run(function () { return addRow(tbody.dataset.section, null, "below"); });
|
||||
} });
|
||||
showContextMenu(x, y, items);
|
||||
}
|
||||
table.addEventListener("click", function (e) {
|
||||
const b = e.target.closest("[data-meet-act]");
|
||||
if (!b) return;
|
||||
@@ -11204,13 +11224,23 @@
|
||||
if (b.dataset.meetAct === "menu") {
|
||||
const r = b.getBoundingClientRect();
|
||||
rowMenu(r.left, r.bottom + 4, tr);
|
||||
} else if (b.dataset.meetAct === "sec-menu") {
|
||||
const r = b.getBoundingClientRect();
|
||||
secMenu(r.left, r.bottom + 4, b.closest("tbody"));
|
||||
} else if (b.dataset.meetAct === "sec-add") {
|
||||
run(function () { return addRow(b.closest("tbody").dataset.section, null, "below"); });
|
||||
}
|
||||
});
|
||||
table.addEventListener("contextmenu", function (e) {
|
||||
if (e.target.closest(".is-editing")) return;
|
||||
const sec = e.target.closest("tbody.pj-meet-sec th.pj-meet-c-sec");
|
||||
if (sec && canEdit) {
|
||||
e.preventDefault();
|
||||
secMenu(e.clientX, e.clientY, sec.closest("tbody"));
|
||||
return;
|
||||
}
|
||||
const th = e.target.closest("th.pj-meet-c-label");
|
||||
if (!th || e.target.closest(".is-editing")) return;
|
||||
if (!th) return;
|
||||
e.preventDefault();
|
||||
rowMenu(e.clientX, e.clientY, th.closest("tr"));
|
||||
});
|
||||
|
||||
@@ -1191,6 +1191,11 @@ Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Frame
|
||||
잠근 트랜잭션 안에서 DB 연결을 더 빌리지 않음). 기본 담당자 지정도 같은 기준. 협업자 추가는 담당자 후보와 같은 `access.can_assign`
|
||||
(예전엔 관리자는 멤버가 아니어도 넣을 수 있었다).
|
||||
|
||||
- **회의록 구역 순서**(2026-10-12): 첫 열 "구분" 칸 우클릭·⋯ = 구역 위로·아래로·구역 끝에 줄 추가.
|
||||
`POST /api/goals/meeting-items/{item_id}/move-section {direction: -1|1}`(그 구역의 아무 줄) → `move_meeting_section` 이 회의록
|
||||
행 잠금 안에서 이어진 같은 구역 줄 묶음과 옆 묶음의 자리를 바꾼다(묶음 안 줄 순서·세로 병합 그대로, 맨 끝이면 그대로). 줄 이동과 같은
|
||||
권한(누구나, 회의 완료면 409). 다음 회의록은 `create_meeting` 이 이 순서를 이어받는다. 마이그레이션 없음.
|
||||
|
||||
정책 결정이 필요한 것(바꾸지 않음): 배정·완료 **메일**은 `PROJECT_NOTIFY_EMAIL`(없으면 Admin 전원)에게 프로젝트·작업 제목·담당자가
|
||||
간다 — 화면에선 비멤버 Admin 이 그 프로젝트를 못 보지만 메일로는 제목을 받는다(4장 관리자 보고 정책).
|
||||
|
||||
|
||||
@@ -352,6 +352,29 @@ function meetServer(env, st) {
|
||||
{ nav: env.navigations });
|
||||
});
|
||||
|
||||
// 첫 열(구분) — 구역 통째로 위/아래(우클릭·⋯), 맨 위는 "위로" 없음, 구역 첫 줄 id 로 요청
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
meetServer(env);
|
||||
await boot(env);
|
||||
const blocks = Array.from(env.d.querySelectorAll("tbody.pj-meet-sec"));
|
||||
blocks[0].querySelector("th.pj-meet-c-sec").dispatchEvent(new env.w.MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: 5, clientY: 5 }));
|
||||
let labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel);
|
||||
check("[1e] 첫 구역 우클릭 — 구역 아래로·구역 끝에 줄 추가(위로 없음)",
|
||||
labels.indexOf("구역 아래로") >= 0 && labels.indexOf("구역 위로") < 0 && labels.indexOf("구역 끝에 줄 추가") >= 0, labels);
|
||||
Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).find(function (b) { return itemLabel(b) === "구역 아래로"; }).click();
|
||||
await settle(); await wait(20); await settle();
|
||||
const firstId = blocks[0].querySelector("tr[data-item]").dataset.item;
|
||||
const call = env.calls.find(function (c) { return /\/move-section$/.test(c.url); });
|
||||
check("[1e] 구역 아래로 → 그 구역 첫 줄로 move-section(direction 1) 후 새로고침",
|
||||
!!call && call.method === "POST" && call.url.indexOf("/meeting-items/" + firstId + "/move-section") >= 0 &&
|
||||
call.body.direction === 1 && env.navigations === 1, [call, env.navigations]);
|
||||
const last = blocks[blocks.length - 1];
|
||||
last.querySelector('[data-meet-act="sec-menu"]').click();
|
||||
labels = Array.from(env.d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel);
|
||||
check("[1e] 마지막 구역 ⋯ — 구역 위로(아래로 없음)", labels.indexOf("구역 위로") >= 0 && labels.indexOf("구역 아래로") < 0, labels);
|
||||
});
|
||||
|
||||
// ════════════════════ [2] 숫자 — 늦은 응답이 최신 입력을 덮지 않음 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.goals_admin, GOALS_URL);
|
||||
|
||||
@@ -32,6 +32,10 @@ class LockConnection(Connection):
|
||||
if params[0] not in self.meetings:
|
||||
return Result([])
|
||||
return Result([{"completed_at": "done" if params[0] in self.completed else None}])
|
||||
if sql.startswith("SELECT id, week_start") and "FROM goal_meeting_items" in sql and "ORDER BY sort_order" in sql:
|
||||
self.calls.append((sql, params)) # 실제 쿼리처럼 sort_order 순으로(기본 모형은 ORDER BY 를 무시한다)
|
||||
return Result(dict(r) for r in sorted(self.rows.values(), key=lambda r: (r["sort_order"], r["id"]))
|
||||
if r["week_start"] == params[0])
|
||||
if sql.startswith("UPDATE goal_meetings SET"):
|
||||
assert self.locked and self.depth > 0, "머리 변경은 회의록 행을 잠근 트랜잭션 안에서"
|
||||
self.calls.append((sql, params))
|
||||
@@ -95,6 +99,38 @@ class MeetingLockTests(unittest.TestCase):
|
||||
self.st.update_meeting(week_start=date(2026, 9, 28), fields={"notes": "잠김"})
|
||||
self.assertEqual(sum(1 for s, _ in self.conn.calls if s.startswith("UPDATE goal_meetings SET")), 1)
|
||||
|
||||
def order(self):
|
||||
return [r["id"] for r in sorted(self.conn.rows.values(), key=lambda r: r["sort_order"])]
|
||||
|
||||
def test_move_section_swaps_whole_blocks(self):
|
||||
# 1·2·3 = 상품, 4 = 유통 → 유통을 위로 = 4,1,2,3 (상품 안 순서·병합은 그대로 따라감)
|
||||
self.conn.rows[1]["content_row_span"] = 2
|
||||
self.st.move_meeting_section(item_id=4, direction=-1)
|
||||
self.assertEqual(self.order(), [4, 1, 2, 3])
|
||||
self.assertEqual(self.conn.rows[1]["content_row_span"], 2)
|
||||
self.st.move_meeting_section(item_id=4, direction=-1) # 맨 위 — 그대로
|
||||
self.assertEqual(self.order(), [4, 1, 2, 3])
|
||||
self.st.move_meeting_section(item_id=2, direction=1) # 상품(이제 맨 아래)의 아무 줄로 아래로 — 그대로
|
||||
self.assertEqual(self.order(), [4, 1, 2, 3])
|
||||
self.st.move_meeting_section(item_id=4, direction=1)
|
||||
self.assertEqual(self.order(), [1, 2, 3, 4])
|
||||
|
||||
def test_move_section_locked_after_completion(self):
|
||||
self.conn.completed.add(date(2026, 9, 28))
|
||||
with self.assertRaises(store.MeetingLocked):
|
||||
self.st.move_meeting_section(item_id=4, direction=-1)
|
||||
|
||||
def test_move_section_api(self):
|
||||
app = FastAPI()
|
||||
app.include_router(api.router)
|
||||
app.state.project_store = self.st
|
||||
client = TestClient(app)
|
||||
with patch.object(api, "_require_user", return_value=dict(role="user", email="member@test.local")):
|
||||
self.assertEqual(client.post("/project/api/goals/meeting-items/4/move-section", json={"direction": 0}).status_code, 400)
|
||||
self.assertEqual(client.post("/project/api/goals/meeting-items/4/move-section", json={"direction": -1}).status_code, 200)
|
||||
self.assertEqual(self.order(), [4, 1, 2, 3])
|
||||
self.assertEqual(client.post("/project/api/goals/meeting-items/99/move-section", json={"direction": 1}).status_code, 404)
|
||||
|
||||
def test_anyone_edits_but_only_admin_completes(self):
|
||||
app = FastAPI()
|
||||
app.include_router(api.router)
|
||||
|
||||
@@ -1166,6 +1166,36 @@ def test_review_meeting_result_lock_rules():
|
||||
_drop_meetings([w1, w2])
|
||||
|
||||
|
||||
def test_review_meeting_section_move():
|
||||
"""구역(첫 열) 통째로 위/아래 — 묶음 안 줄 순서 그대로, 다음 주 회의록이 바뀐 순서를 이어받는다."""
|
||||
from app.modules.project import store
|
||||
|
||||
w1 = store.month_weeks(2031, 11)[1][0] # 11월 2주차 시작일(주차 시작일이어야 회의록을 만든다)
|
||||
w2 = store.week_period(w1)[1] + timedelta(days=1)
|
||||
_drop_meetings([w1, w2])
|
||||
try:
|
||||
_create_meeting(w1)
|
||||
secs = lambda w: [s for i, s in enumerate(r["section"] for r in ST.get_meeting(week_start=w)["items"])
|
||||
if i == 0 or s != ST.get_meeting(week_start=w)["items"][i - 1]["section"]]
|
||||
before = secs(w1)
|
||||
assert len(before) >= 2, before
|
||||
items = ST.get_meeting(week_start=w1)["items"]
|
||||
second = next(r for r in items if r["section"] == before[1])
|
||||
labels_second = [r["label"] for r in items if r["section"] == before[1]]
|
||||
r = req("POST", f"/project/api/goals/meeting-items/{second['id']}/move-section", BOB, json={"direction": -1})
|
||||
assert r.status_code == 200, r.text
|
||||
after = secs(w1)
|
||||
assert after[:2] == [before[1], before[0]] and after[2:] == before[2:], (before, after)
|
||||
assert [r["label"] for r in ST.get_meeting(week_start=w1)["items"] if r["section"] == before[1]] == labels_second
|
||||
_create_meeting(w2)
|
||||
assert secs(w2) == after # 다음 회의록은 바뀐 구역 순서를 이어받는다
|
||||
ST.set_meeting_completed(week_start=w1, done=True, by=ADMIN)
|
||||
assert req("POST", f"/project/api/goals/meeting-items/{second['id']}/move-section", BOB,
|
||||
json={"direction": 1}).status_code == 409 # 회의 완료 뒤 잠금
|
||||
finally:
|
||||
_drop_meetings([w1, w2])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not ENABLED:
|
||||
print("SKIP: PROJECT_TEST_DB_URL(localhost) not set")
|
||||
|
||||
Reference in New Issue
Block a user