EnergyVenom's picture
Tidy the web app: pages by area, CSS in load order, web/README.md (b2a039d)
fb43301 verified
Raw History Blame Contribute Delete
1.43 kB
"""Patch cycles: Oracle Fusion ships a quarterly update (named by year and quarter letter: 25D, 26A, 26B, 26C) and monthly
updates between them. The patch name on a test run is free text; this module only reads it, so the app can say which
cadence a patch belongs to and sort patches by how recently they were tested. web/src/domain/runName.ts has the same rules."""
from __future__ import annotations
import re
QUARTERLY = re.compile(r"^(\d{2})\s*-?\s*([A-D])$", re.I) # 26C
MONTHLY = re.compile(r"^(?:(20\d{2})[-/.](0[1-9]|1[0-2])|(\d{2})([A-D])[-_ ]?(?:M|MONTHLY)[-_ ]?(\d{1,2}))$", re.I) # 2026-10, 26C-M2
def classify(patch_id: str | None) -> dict:
"""{"patch_id", "cadence": quarterly|monthly|other|none, "label"}"""
p = (patch_id or "").strip()
if not p:
return {"patch_id": "", "cadence": "none", "label": "No patch name"}
m = QUARTERLY.match(p)
if m:
q = m.group(2).upper()
return {"patch_id": p, "cadence": "quarterly", "label": f"{m.group(1)}{q} quarterly update"}
m = MONTHLY.match(p)
if m:
if m.group(1):
return {"patch_id": p, "cadence": "monthly", "label": f"{m.group(1)}-{m.group(2)} monthly update"}
return {"patch_id": p, "cadence": "monthly", "label": f"{m.group(3)}{m.group(4).upper()} monthly update {m.group(5)}"}
return {"patch_id": p, "cadence": "other", "label": p}