Merge dev: family canon, milestone 463 steps 1-6 #206
@@ -620,9 +620,12 @@ async def undo(user_id: int, decision_id: int, *, reason: str, decided_via: str
|
|||||||
raise ValueError(f"decision {decision_id} cannot be undone: {why}")
|
raise ValueError(f"decision {decision_id} cannot be undone: {why}")
|
||||||
idea = await session.get(FamilyIdea, target.idea_id)
|
idea = await session.get(FamilyIdea, target.idea_id)
|
||||||
before = await _snapshot(session, idea)
|
before = await _snapshot(session, idea)
|
||||||
|
# No recorded prior state means the decision CREATED the idea: before
|
||||||
|
# it, the record had no applicability test and no scope. It comes back
|
||||||
|
# as retired, with neither, rather than being deleted with its log.
|
||||||
prior = target.before or {
|
prior = target.before or {
|
||||||
"status": "retired", "applies_when": idea.applies_when or "",
|
"status": "retired", "applies_when": "",
|
||||||
"canon_version": idea.canon_version, "platforms": before["platforms"],
|
"canon_version": idea.canon_version, "platforms": [],
|
||||||
}
|
}
|
||||||
if prior["status"] == "canon" and not (prior.get("applies_when") or "").strip():
|
if prior["status"] == "canon" and not (prior.get("applies_when") or "").strip():
|
||||||
raise ValueError("the recorded prior state is canon with no 'applies when'")
|
raise ValueError("the recorded prior state is canon with no 'applies when'")
|
||||||
|
|||||||
Reference in New Issue
Block a user