Skip to content

Commit

Permalink
Merge pull request #53 from ymaheshwari1/#52
Browse files Browse the repository at this point in the history
Fixed: issue when creating a new rule due to state update failure, and added a null check when checking for promise date filter(#52)
  • Loading branch information
ymaheshwari1 authored Jan 31, 2024
2 parents 335f932 + 7eff006 commit 067375e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/store/modules/orderRouting/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const actions: ActionTree<OrderRoutingState, RootState> = {

async createRoutingRule({ commit, state }, payload) {
const currentRoute = JSON.parse(JSON.stringify(state.currentRoute))
let routingRules = currentRoute.rules?.length ? currentRoute.rules : []
let routingRules = currentRoute.rules?.length ? JSON.parse(JSON.stringify(currentRoute.rules)) : []
let routingRuleId = ''

try {
Expand All @@ -197,6 +197,7 @@ const actions: ActionTree<OrderRoutingState, RootState> = {
routingRules = sortSequence(routingRules)
}

currentRoute["rules"] = routingRules
commit(types.ORDER_ROUTING_CURRENT_ROUTE_UPDATED, currentRoute)
}
} catch(err) {
Expand Down
8 changes: 6 additions & 2 deletions src/views/BrokeringQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ function updatePartialAllocation(checked: any) {
}
function isPromiseDateFilterApplied() {
if(!currentRouting.value["rules"]?.length) {
return;
}
const filter = getFilterValue(orderRoutingFilterOptions.value, ruleEnums, 'PROMISE_DATE')
// When promise date range is selected for order filter, we will revert any change made to the partialAllocation enum and will change it to its initial value and will disable the partial allocation feature
Expand Down Expand Up @@ -862,11 +866,11 @@ async function save() {
const rule = rulesDiff[key]
if(rule.filtersToRemove?.length) {
await store.dispatch("orderRouting/deleteRuleConditions", rule.filtersToRemove)
await store.dispatch("orderRouting/deleteRuleConditions", { routingRuleId: rule.routingRuleId, conditions: rule.filtersToRemove })
}
if(rule.actionsToRemove?.length) {
await store.dispatch("orderRouting/deleteRuleActions", rule.actionsToRemove)
await store.dispatch("orderRouting/deleteRuleActions", { routingRuleId: rule.routingRuleId, actions: rule.actionsToRemove })
}
if(rule.filtersToUpdate?.length || rule.actionsToUpdate?.length) {
Expand Down

0 comments on commit 067375e

Please sign in to comment.