fix(spp_case_base): clear is_current when an intervention plan is completed - #478
Open
LunarCapsule127 wants to merge 2 commits into
Open
fix(spp_case_base): clear is_current when an intervention plan is completed#478LunarCapsule127 wants to merge 2 commits into
LunarCapsule127 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change needed?
action_completemarked a planstate = "completed"and stampedactual_end_date, but never releasedis_current. Since the only other writer ofis_current = Falsewas the revision path, a plan that finished normally stayed the case's current plan indefinitely.That left every consumer of the pair reading an incoherent state:
current_plan_id(derived purely fromis_current) kept pointing at completed work, while "has an active plan" derivations read False. It also tripped the one-current-plan-per-case constraint, blocking anyone from marking a fresh plan as current.Fixes #458.
How was the change implemented?
Folded
"is_current": Falseinto the existingaction_completewrite, so completing a plan ends its tenure as the case's current plan the same wayaction_create_revisionalready does. The change goes throughwrite(), so downstream overrides observe it (the reporter noted a local override they can drop once this lands).New unit tests
test_complete_clears_is_currentinspp_case_base/tests/test_case_intervention_plan.py: creates a current plan, confirms it is the case'scurrent_plan_id, completes it, then assertsstate == "completed",is_currentis False, and the case has no current plan.Unit tests executed by the author
(fill in after you run them; see the command below)
How to test manually
Related links