Skip to content

Commit

Permalink
Merge pull request #73 from vtex-apps/fix/order-is-delivered
Browse files Browse the repository at this point in the history
[Fix][OMS-4482] Fix isDelivered
  • Loading branch information
batatavf2 authored Aug 15, 2023
2 parents ad091e7 + 1a9a3e0 commit 8354c02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- `isDelivered` function returns `false` when is not possible to tell whether an invoice is `input` or `output`.

## [1.7.0] - 2023-06-01

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions react/components/ProgressBar/getOrderProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function isCarrierHandling(packages: any) {
export default function getOrderProgress(status: string, packages: any) {
let progress = statusMap[status]
const isPickup = isOrderPickUp(packages)

if (progress === FOURTH_STEP) {
if (
isDelivered(packages) ||
Expand All @@ -60,5 +61,6 @@ export default function getOrderProgress(status: string, packages: any) {
progress = FIFTH_STEP
}
}

return progress
}
8 changes: 5 additions & 3 deletions react/components/ProgressBar/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ export function isDelivered(packages: any) {
}

const isDelivered = !packages.some(
(pack: any) =>
pack?.package?.type === OutputPackageType &&
!pack?.package?.courierStatus?.finished
(pack: any) => {
if (!pack?.package) return true // In case you can't tell whether the invoice is input or output, the order as a whole should be considered as not delivered.

return pack?.package?.type === OutputPackageType &&
!pack?.package?.courierStatus?.finished}
)

return isDelivered
Expand Down

0 comments on commit 8354c02

Please sign in to comment.