Files
Aislo/B06_Section/B06_Section_Router_DesignSave_Progress.py
T
eomsangdonandClaude Opus 5.5 ed9e014db2 feat(520-4): B05 · B06 페이지 넘김 공용 moveStage — B06 [>] 잠금판 「설계 확정」 서버 저장 차례 n/N 이름 · 배수유역 다시 셈 한 번
- B06 [>] · 단계 판 B07~B09 = moveStage 한 단계(설계 확정) · progress = GET /design/save/progress 1 s 물음 · B03 · B04 로 = moveStage 잠금 길(떠남 확인은 잠금 풀린 뒤)
- 낡음 확인 창 · 화면 side.update() 걷음 — 배수유역은 서버 [확정] 관 차례가 한 번만 셈 · 진행 이름 「배수유역 다시 셈」(basins)
- 서버 _run_steps step() 진행을 메모리(B06_Section_Router_DesignSave_Progress) · 차례 목록 = N · 끝에 비움
- 노선 바뀐 채 [>] = 물음(잠금판 위 · z 1050 > 900) → 다시 세운 페이지 둘째 확정을 저장 줄 밖에서 기다림 → 잠금판이 다시 마운트를 넘어 이어져 이동 · 120 s 넘으면 머묾
- saveSharedDesign 이 참 · 거짓을 돌려줌 · 확정 이동은 부른 쪽(moveStage)
- 낡은 시험 고침 — 512_2(확인 창 → 잠금판 한 단계 · 서버 basins) · 298_3 · 272 · b06_save_channels · b06_save_recompute(글 약속 새 길)
- helper_ts_stub_loader .css = 빈 모듈 — 520-3 ui_template_progress.css import 로 451 · 384_4 · 416 등 helper 시험이 깨짐(브레인 승인)
- 새 시험 test_520_4_save_progress(n/N · 배수유역 자리)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 08:19:22 +09:00

51 lines
1.8 KiB
Python

"""B05 · B06 한 본문 저장 진행(PLAN 520-4) — 지금 도는 차례 이름 · n/N · 지난 초를 메모리에.
`B06_Section_Router_DesignSave._run_steps` 가 차례마다 `mark` · 끝에 `end` · 화면 잠금판이 1 s 마다
`GET /design/save/progress`(창구는 `B06_Section_Router_DesignSave`)로 물음
(페이지 넘김 `moveStage` 단계의 progress 칸).
"""
from __future__ import annotations
import time
from typing import Any
from uuid import UUID
# ponytail: 프로세스 메모리 한 벌 — 서버 일꾼이 여럿이면 다른 일꾼 진행은 안 보임(그때 파일 · DB 로)
_PROGRESS: dict[str, dict[str, Any]] = {}
def begin(project_id: UUID, planned: list[str]) -> None:
"""저장 한 번 시작 — 차례 이름 목록(N)을 적음."""
_PROGRESS[str(project_id)] = {"planned": planned, "step": None, "started": time.monotonic()}
def mark(project_id: UUID, name: str) -> None:
"""차례 들어감 — 목록 밖 이름(배수유역 다시 셈 등)은 앞 차례 자리 그대로."""
entry = _PROGRESS.get(str(project_id))
if entry is not None:
entry["step"] = name
def end(project_id: UUID) -> None:
_PROGRESS.pop(str(project_id), None)
def snapshot(project_id: UUID) -> dict[str, Any]:
"""지금 진행 — 안 돌면 active 거짓."""
entry = _PROGRESS.get(str(project_id))
if entry is None or entry["step"] is None:
return {"active": False}
planned: list[str] = entry["planned"]
step = entry["step"]
# 배수유역 다시 셈 = 관 차례 안 · 자리는 관
seat = "pipes" if step == "basins" else step
index = planned.index(seat) + 1 if seat in planned else len(planned)
return {
"active": True,
"step": step,
"index": index,
"total": len(planned),
"elapsed_s": round(time.monotonic() - entry["started"], 1),
}