Skip to content

fix: handle UNAPPROVED_ABOVE status - #18

Merged
mediremi merged 2 commits into
masterfrom
fix-status-tag-unapproved-above
Jul 7, 2021
Merged

fix: handle UNAPPROVED_ABOVE status#18
mediremi merged 2 commits into
masterfrom
fix-status-tag-unapproved-above

Conversation

@mediremi

@mediremi mediremi commented Jul 6, 2021

Copy link
Copy Markdown
Contributor

Handle the UNAPPROVED_ABOVE status in the same way we handle UNAPPROVED_WAITING and UNAPPROVED_ELSEWHERE.


case 'UNAPPROVED_WAITING':
case 'UNAPPROVED_ELSEWHERE':
case 'UNAPPROVED_ABOVE':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I get these docs (search for "UNAPPROVED_ABOVE") right, the this means that it's already been approved and the next level has to approve it, but I'm really not sure if I'm interpreting the docs correctly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What I mean is: Is "waiting" the right label?

@HendrikThePendric HendrikThePendric Jul 6, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I’m not sure about the correct interpretation either, but we need to get these confirmed anyway, so I guess we can add this state to this case (waiting) for now.

Now that we already encountered this undocumented state on day 1 already, I think we should:

  • Definitely talk to Lars/Jim about the correct interpretation of these states
  • Probably scan the dhis-core source code for a complete overview of the statuses

Probably it makes sense to ensure we have a complete list before we talk to one of them…

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PS: I am referring to this state as undocumented because I don’t see it in the list of approval states. Could be I’m not looking properly or in the wrong place…

@HendrikThePendric HendrikThePendric Jul 7, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had a look in the dhis2-core code-base and was expecting the relevant section of code to be in the DataApprovalState.java file. But that only contained the 7 states and we already had comprised a list of 8 from the docs:

UNAPPROVABLE
APPROVED_ELSEWHERE // in docs, but not in DataApprovalState.java
UNAPPROVED_ABOVE
UNAPPROVED_WAITING
UNAPPROVED_READY
APPROVED_ABOVE
APPROVED_HERE
ACCEPTED_HERE

Then looked in dataApproval.js (I think the is the Javascript part of the old struts app) and there I found 14 states:

ACCEPTED_ELSEWHERE
ACCEPTED_HERE
APPROVED_ABOVE
APPROVED_ELSEWHERE
APPROVED_HERE
PARTIALLY_ACCEPTED_ELSEWHERE
PARTIALLY_ACCEPTED_HERE
PARTIALLY_APPROVED_ELSEWHERE
PARTIALLY_APPROVED_HERE
UNAPPROVABLE
UNAPPROVED_ABOVE
UNAPPROVED_ELSEWHERE
UNAPPROVED_READY
UNAPPROVED_WAITING

What was puzzling to is how the JavaScript file could have to deal with more approval states than defined in the Java code. I think we need to get more info on this.

For now, I guess we could just add the case UNAPPROVED_ABOVE as you suggested, but perhaps it would be good to also add a default case which throws a descriptive error message?

@mediremi
mediremi merged commit de88cd2 into master Jul 7, 2021
@dhis2-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants