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

OBPIH-5854 New approval statuses in SM list pages - Approvals lists pages (fix after QA) #4311

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

alannadolny
Copy link
Collaborator

No description provided.

@@ -39,6 +39,7 @@ class OutboundStockMovementService {
Date createdAfter = params.createdAfter ? Date.parse("MM/dd/yyyy", params.createdAfter) : null
Date createdBefore = params.createdBefore ? Date.parse("MM/dd/yyyy", params.createdBefore) : null
List<ShipmentType> shipmentTypes = params.list("shipmentType") ? params.list("shipmentType").collect{ ShipmentType.read(it) } : null
Boolean isApprovalRequired = stockMovement?.origin?.isApprovalRequired()
Copy link
Collaborator

Choose a reason for hiding this comment

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

not a change request: since it is a transient, you can access it through the property like: origin.approvalRequired

if (!isApprovalRequired) {
not {
'in'("status", [RequisitionStatus.APPROVED])
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the expected behavior of this else statement? this else triggers if not stockMovement.sourceType, but just wanted to hear from you what it means at this point.
Shouldn't it be rather

if (stockMovement.sourceType == RequisitionSourceType.ELECTRONIC) {
 ...
} else {
 ...
}

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When we are on the stock movements list we don't pass any params with sourceType - it's just null. The code that you proposed was my first version of the fix, but I had to check it in the debugger and then I saw this.

@@ -98,6 +99,20 @@ class OutboundStockMovementService {
not {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this not be together with the next one or it should be one of these depending on the case if it it approval required or not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Those nots are separated by purpose:
For example, it can be read also as

  • if approval is required: check if status is in [CREATED, ISSUED, CANCELED]
  • if approval is not required: check if the status is in [CREATED, ISSUED, CANCELED, APPROVED, PENDING_APPROVAL, REJECTED]

I just moved the common part higher, and because of that I got rid of one additional else and longer lists of statuses

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it might be easier to follow the code if it was (with some commentary around it):

if required {
    not in the list of some statuses + list of other statuses
} else {
    not in the list of some statuses
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you sure about that? This redundancy of statuses looks odd to me, so maybe it would be enough when I add just comments around the current code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added some comments for now, if you think it's not enough, let me know

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, I think this makes sense for now

}
}
} else {
not {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same question as above

@awalkowiak awalkowiak merged commit 3cc823d into develop Oct 4, 2023
3 checks passed
@awalkowiak awalkowiak deleted the OBPIH-5854-fix branch October 4, 2023 10:15
awalkowiak pushed a commit that referenced this pull request Oct 26, 2023
…ages (fix after QA) (#4311)

* OBPIH-5854 Remove statuses that are not on the filtering options

* OBPIH-5854 Add comments for filtering stock movements
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.

None yet

3 participants