Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set status for canceled cases #1202

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

open-dynaMIX
Copy link
Member

@open-dynaMIX open-dynaMIX commented Jan 30, 2025

Cancelled cases are still accessible via their URL. So the status needs
to be set correctly. This commit adds a new status canceled and
sets it on cancelation of a case.

Additionally the event handlers were refactored in the following way:

  • only cases with the document-review Workflow get a status applied.
  • The status is set on every change of ready WorkItems, not only on the
    expected forward changes. This makes sure, that the status is also
    correct, if a Case was closed and then reopened.

drive-by commit

  • chore(caluma): fix flaky test

@open-dynaMIX open-dynaMIX marked this pull request as ready for review January 30, 2025 13:43
@open-dynaMIX open-dynaMIX requested review from Yelinz and winged January 30, 2025 13:47
next_deployment.md Outdated Show resolved Hide resolved
case=None,
**kwargs,
):
def set_case_status(case=None, work_item=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has so little common code, I'd just split it in two and get rid of the whole if workitem else stuff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed and done 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This messes up my precious coverage 😖

@open-dynaMIX open-dynaMIX force-pushed the set_status_cancelled branch 3 times, most recently from ffd4878 to 9c1fec8 Compare January 31, 2025 08:37
Copy link
Member

@winged winged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@open-dynaMIX
Copy link
Member Author

@winged Had to refactor it a little more. But now it's also more better ;)

Additionally I saw, Caluma uses the spelling canceled and not cancelled. So I've changed it in this PR, to align with Caluma.

@winged
Copy link
Member

winged commented Jan 31, 2025

@winged Had to refactor it a little more. But now it's also more better ;)

Additionally I saw, Caluma uses the spelling canceled and not cancelled. So I've changed it in this PR, to align with Caluma.

Nice! BTW why are we using a meta field here instead of referring to the case's own status field?

Copy link
Member

@winged winged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a small nitpick I've found. Feel free to ignore tho

work_item = (
work_item if work_item else case.work_items.filter(status="ready").first()
)
work_item = case.work_items.filter(status="ready").first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably try to use a constant here

Suggested change
work_item = case.work_items.filter(status="ready").first()
work_item = case.work_items.filter(status=WorkItem.STATUS_READY).first()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all here for the nitpicks ;)
You are correct and it's fixed 👍

Cancelled cases are still accessible via their URL. So the status needs
to be set correctly. This commit adds a new status `canceled` and
sets it on cancelation of a case.

Additionally the event handlers were refactored in the following way:

 - only cases with the `document-review` Workflow get a status applied.
 - The status is set on every change of ready WorkItems, not only on the
   expected forward changes. This makes sure, that the status is also
   correct, if a Case was closed and then reopened.
@open-dynaMIX open-dynaMIX changed the title fix: set status for cancelled cases fix: set status for canceled cases Jan 31, 2025
@open-dynaMIX open-dynaMIX merged commit ae1693c into adfinis:main Jan 31, 2025
6 checks passed
@open-dynaMIX open-dynaMIX deleted the set_status_cancelled branch January 31, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants