Skip to content

Commit

Permalink
Fixed: a case when adding and removing a filter for which the value t…
Browse files Browse the repository at this point in the history
…ype changes from the app side by removing strict equality checking for value field and added check to not update promiseDate value when popover is closed without any action
  • Loading branch information
ymaheshwari1 committed Jan 29, 2024
1 parent c00dca2 commit 0b4d973
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,9 @@ async function selectPromiseFilterValue(ev: CustomEvent) {
})
popover.onDidDismiss().then((result: any) => {
getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").fieldValue = result.data?.isPastDuration ? `-${result.data?.duration}` : result.data?.duration
if(result.data?.duration || result.data?.duration == 0) {
getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").fieldValue = result.data?.isPastDuration ? `-${result.data?.duration}` : result.data?.duration
}
getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").operator = "less-equals"
})
Expand Down Expand Up @@ -694,7 +696,8 @@ function findFilterDiff(previousSeq: any, updatedSeq: any) {
return diff
}
if (updatedSeq[key].fieldName === previousSeq[key].fieldName && updatedSeq[key].fieldValue === previousSeq[key].fieldValue && updatedSeq[key].operator === previousSeq[key].operator) return diff
// Not using strict equality comparison for fieldValue as for some filters the type of value returned from server and the updated value from the app will not be the same(ex. Promise date filter)
if (updatedSeq[key].fieldName === previousSeq[key].fieldName && updatedSeq[key].fieldValue == previousSeq[key].fieldValue && updatedSeq[key].operator === previousSeq[key].operator) return diff
return {
...diff,
[key]: updatedSeq[key]
Expand Down Expand Up @@ -726,7 +729,8 @@ function findActionDiff(previousSeq: any, updatedSeq: any) {
return diff
}
if (updatedSeq[key].actionTypeEnumId === previousSeq[key].actionTypeEnumId && updatedSeq[key].actionValue === previousSeq[key].actionValue) return diff
// Not using strict equality comparison for actionValue as for some filters the type of value returned from server and the updated value from the app will not be the same.
if (updatedSeq[key].actionTypeEnumId === previousSeq[key].actionTypeEnumId && updatedSeq[key].actionValue == previousSeq[key].actionValue) return diff
return {
...diff,
[key]: updatedSeq[key]
Expand Down

0 comments on commit 0b4d973

Please sign in to comment.