Skip to content

Commit

Permalink
Merge pull request #85 from mediocre/dhl-status-startswith
Browse files Browse the repository at this point in the history
Match status on startsWith rather than exact match
  • Loading branch information
javamatte committed Jun 6, 2024
2 parents dc964f6 + c00ef33 commit a15f547
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions carriers/dhl.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ function DHL(options) {
_event.details = event.remark;
}

if (!results.deliveredAt && _event.description && DELIVERED_TRACKING_DESCRIPTIONS.includes(_event.description.toUpperCase())) {
if (!results.deliveredAt && _event.description && DELIVERED_TRACKING_DESCRIPTIONS.find(desc => _event.description.toUpperCase().startsWith(desc))) {
results.deliveredAt = _event.date;
}

if (!results.shippedAt && _event.description && SHIPPED_TRACKING_DESCRIPTIONS.includes(_event.description.toUpperCase())) {
if (!results.shippedAt && _event.description && SHIPPED_TRACKING_DESCRIPTIONS.find(desc => _event.description.toUpperCase().startsWith(desc))) {
results.shippedAt = _event.date;
}

Expand Down
4 changes: 2 additions & 2 deletions carriers/dhlEcommerceSolutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ function DhlEcommerceSolutions(options) {
_event.details = event.secondaryEventDescription;
}

if (!results.deliveredAt && _event.description && DELIVERED_TRACKING_DESCRIPTIONS.includes(_event.description.toUpperCase())) {
if (!results.deliveredAt && _event.description && DELIVERED_TRACKING_DESCRIPTIONS.find(desc => _event.description.toUpperCase().startsWith(desc))) {
results.deliveredAt = _event.date;
}

if (!results.shippedAt && _event.description && SHIPPED_TRACKING_DESCRIPTIONS.includes(_event.description.toUpperCase())) {
if (!results.shippedAt && _event.description && SHIPPED_TRACKING_DESCRIPTIONS.find(desc => _event.description.toUpperCase().startsWith(desc))) {
results.shippedAt = _event.date;
}

Expand Down

0 comments on commit a15f547

Please sign in to comment.