From 54e42628213ad3263f69e5ed3e005bc7ed04a4ed Mon Sep 17 00:00:00 2001 From: Robert Axelsen Date: Thu, 14 Sep 2017 14:29:40 +0200 Subject: [PATCH] TT#20805 Optimize store load function Change-Id: Id676e5e28ceec4f533d7f3f473cb3610423eb17a --- .../pages/callforward/CallForwardController.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/classic/src/view/pages/callforward/CallForwardController.js b/classic/src/view/pages/callforward/CallForwardController.js index ff1a52f7..09669841 100644 --- a/classic/src/view/pages/callforward/CallForwardController.js +++ b/classic/src/view/pages/callforward/CallForwardController.js @@ -185,15 +185,21 @@ Ext.define('NgcpCsc.view.pages.callforward.CallForwardController', { var decodedResponse = Ext.decode(response.responseText); if (decodedResponse._embedded) { var cfdestinationsets = decodedResponse._embedded['ngcp:cfdestinationsets']; - Ext.each(cfTypeArrayOfObjects, function (cfTypeObjects, index) { - var cfType = cfTypes[index]; - Ext.each(cfTypeObjects, function(cfTypeObject) { + // In this loop, we are iterating over an array consisting of 4 arrays, holding 0 or more + // mappings objects, the data from /api/cfmappings. Can not break out of it , as we want + // to iterate over all call forwarding types. + Ext.each(cfTypeArrayOfObjects, function (cfTypeObjects, i) { + var cfType = cfTypes[i]; + Ext.each(cfTypeObjects, function(cfTypeObject, j) { // TODO can we return false to break for this one? var cfmappings = {}; + if (cfType === 'cfu' && j === 1) { + return false; // TODO Does not break out like expected + }; cfmappings.destinationsetName = cfTypeObject.destinationset; cfmappings.sourcesetName = cfTypeObject.sourceset; cfmappings.timesetName = cfTypeObject.timeset; if (cfmappings.timesetName == routeTimeset) { - Ext.each(cfdestinationsets, function(cfdestinationset) { + Ext.each(cfdestinationsets, function(cfdestinationset) { // TODO can we return false to break for this one? if (cfType.match(/(cfb|cfna)/) || cfType === 'cfu' && cfTypeObjects[0].destinationset === cfTypeObject.destinationset || !hasCftAndCfuMappings && cfType === 'cft') { if (cfdestinationset.name == cfmappings.destinationsetName && !cfmappings._modelCreated) { cfdestinationset.destinations = $cf.sortDestinationsetByPriority(cfdestinationset.destinations);