OBPIH-6707 Indicator when quantities in split line do not sum up to o…#4916
OBPIH-6707 Indicator when quantities in split line do not sum up to o…#4916awalkowiak merged 3 commits intodevelopfrom
Conversation
grails-app/i18n/messages.properties
Outdated
| react.partialReceiving.error.expiryWithoutLot.label=Items with an expiry date must also have a lot number. | ||
| react.partialReceiving.error.lotAndExpiryControl.label=Both lot number and expiry date are required for this item. | ||
| react.partialReceiving.confirmReceive.notSupportingPartialReceiving.message=You have not entered a value in the receiving quantity for ${count} line/lines on this shipment. These lines will be received as zero. You will not be able to go back and receive them later. Do you want to continue? | ||
| react.partialReceiving.mismatchingQuantityShipped.label=The total edited quantity does not match the original quantity shipped. |
There was a problem hiding this comment.
I think we should follow one pattern when naming those labels. I saw that we are using .error. in the labels.
So maybe we can call it like: react.partialReceiving.error.mismatchingQuantityShipped.label
There was a problem hiding this comment.
yeah I agree, I never feel comfortable adding a new label because I always wonder if any pattern is applicable there.
| .reduce((acc, [key, value]) => | ||
| ({ | ||
| ...acc, | ||
| [key]: value.reduce((sum, curr) => (sum + _.toInteger(curr.quantityShipped)), 0), |
There was a problem hiding this comment.
you can just use sum or sumBy instead of using nested reduce.
| * as after mapping, the result would look like | ||
| * [[<shipmentItem>, <shipmentItem>], [<shipmentItem>, <shipmentItem>]] | ||
| */ | ||
| const shipmentItems = containers.map((container) => container.shipmentItems).flat(); |
There was a problem hiding this comment.
what about _.flatten?
There was a problem hiding this comment.
I don't see any advantage of that, since flat() does the same
There was a problem hiding this comment.
you're right, so I think you can use _.flatMap instead 😄
There was a problem hiding this comment.
🤔 I swear I checked whether the .flatMap exists in JS, but couldn't find it, and suddenly it exists 😆
| const { shipmentItemQuantityShippedSum } = this.state; | ||
| const originalItem = values.find((item) => item.rowId); | ||
| const qtyShippedSumFromModal = | ||
| values.reduce((acc, curr) => acc + _.toInteger(curr.quantityShipped), 0); |
…riginal qty
✨ Description of Change
Link to GitHub issue or Jira ticket:
Description:
📷 Screenshots & Recordings (optional)