feat(776-2): 실무자료 HP 에 읽기 꼴 판 찍음 — 다른 판 = 지난 것(목록 숨김 · 다음 올림 때 끝냄)
- Store.BOOK = 2 · save 가 「판」 찍음 · stale = 하루 지남 또는 판 다름 - 작업 중 열기 409 「다시 올림」은 Forget.finish 옛 판 읽기 한 줄과 함께(받기 뒤) - 시험 test_718_1 판 지킴 한 개 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
한시 불러오기(718-1 · 743-1) — 파일에 `지문`(올린 엑셀 sha256) · 목록 = 지문 있고 하루 안 지난 것
|
||||
(작업 중)만 · 옛 HP · 하루 지난 HP 는 목록에서 숨김(지움 = `M02_Hopyo_Forget`) ·
|
||||
`실무자료/불러옴.json` `{번}` = 낸 키 가장 큰 번(지운 뒤에도 키를 다시 안 씀 · 옛 `지문` 안 읽음).
|
||||
판(776-2) = 읽기 꼴(Book) 판 `BOOK` 을 HP 에 찍음 · 다른 판 = 지난 것(목록에서 숨김 ·
|
||||
다음 올림 때 끝냄 · 옛 꼴 읽기 갈래 없음 — 다시 올림).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -29,6 +31,7 @@ GRID = "격자"
|
||||
DONE = "불러옴"
|
||||
NO_GRID = "격자 없음 — 다시 올리면 보임"
|
||||
EXPIRE = timedelta(days=1) # 작업 중 HP 보관 — 올린 뒤 하루
|
||||
BOOK = 2 # 읽기 꼴(Book) 판 — 읽기 · 정규화 출력 꼴을 바꾸면 올림
|
||||
_KEY = re.compile(r"^HP-(\d{6})$")
|
||||
# ponytail: 프로세스 안 잠금 — 서버를 여럿 띄우면 파일 잠금으로
|
||||
_LOCK = threading.Lock()
|
||||
@@ -71,7 +74,9 @@ def fingerprint(data: bytes) -> str:
|
||||
|
||||
|
||||
def stale(doc: dict[str, Any], now: datetime | None = None) -> bool:
|
||||
"""하루 지난 HP — 올린때 기준 · 못 읽는 때 = 지난 것."""
|
||||
"""하루 지난 HP · 다른 판 HP — 올린때 기준 · 못 읽는 때 = 지난 것."""
|
||||
if doc.get("판") != BOOK:
|
||||
return True
|
||||
try:
|
||||
when = datetime.fromisoformat(str(doc.get("올린때") or "").replace("Z", "+00:00"))
|
||||
except ValueError:
|
||||
@@ -131,6 +136,7 @@ def save(
|
||||
"올린이": who,
|
||||
**({"지문": mark} if mark else {}),
|
||||
**parsed,
|
||||
"판": BOOK,
|
||||
}
|
||||
if grid is not None:
|
||||
book = {**grid["책"], "열": key}
|
||||
|
||||
@@ -91,3 +91,10 @@ def test_결과_단가산출_산근_블록_기초_SK_고름대기_겹침_없음(
|
||||
assert res["만든"] == len(docs) # 같은 내용 SK 한 벌 — 사본 걷은 문서 수
|
||||
assert len(list((folder / "sangeun").glob("SK-*.json"))) == len(docs) # 남음
|
||||
assert _post(client).status_code == 200 # 743-1 — 다시 올림 됨
|
||||
|
||||
|
||||
def test_판_다른_HP_지난_것():
|
||||
"""776-2 — 읽기 꼴 판이 다르면(옛 판 · 판 없음) 막 올렸어도 지난 것 = 목록 숨김 · 다음 올림 때 끝냄."""
|
||||
now = {"올린때": "2999-01-01T00:00:00Z"}
|
||||
assert hs.stale({**now, "판": hs.BOOK}, now=None) is False
|
||||
assert hs.stale(now) and hs.stale({**now, "판": hs.BOOK - 1})
|
||||
|
||||
Reference in New Issue
Block a user