diff --git a/process/migrate_themesAsTopics_serverProcess/process.js b/process/migrate_themesAsTopics_serverProcess/process.js index 52496b2230dc44fd3cc41656f834a8f7b8f1f7fd..f451dc6ab10d39afbadd91fb4d5261cfead041d9 100644 --- a/process/migrate_themesAsTopics_serverProcess/process.js +++ b/process/migrate_themesAsTopics_serverProcess/process.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.eMath"); import("TopicTree_lib"); import("system.logging"); @@ -111,7 +112,7 @@ function _migrateTopicTree(pThemes) topicObj[themeId]["insertHelper"]["columns"].push("DATE_NEW"); topicObj[themeId]["insertHelper"]["values"].push(date_new); - if(theme_id && Utils.isNotNullOrEmpty(theme_id)) + if(theme_id && Utils.isNotNullOrEmptyString(theme_id)) { topicObj[themeId]["assignedTo"] = theme_id; topicsToLoopTrough.push(themeId); @@ -169,8 +170,11 @@ function _migrateTopicTree(pThemes) previousLayer = TopicTreeUtils.getPreviousLayerName(previousLayer); if(previousLayer != "SORTING_LAYER_0") { - topicObj[themeId]["insertHelper"]["columns"].push(previousLayer); - topicObj[themeId]["insertHelper"]["values"].push(-1);//value doesn't matter here + if(!topicObj[themeId]["insertHelper"]["columns"].includes(previousLayer)) + { + topicObj[themeId]["insertHelper"]["columns"].push(previousLayer); + topicObj[themeId]["insertHelper"]["values"].push("-1");//value doesn't matter here + } } else { @@ -210,8 +214,7 @@ function _migrateTopicTree(pThemes) //we don't change the original order tho, since we used the stored sortingValue to sort said array that we are now looping trough var sortingValue = eMath.addInt(i, 1); - topicTreeColumns.push(topicObj[ownTopicId]["layer"]); - topicTreeValues.push(sortingValue); + topicTreeValues[topicTreeColumns.indexOf(topicObj[ownTopicId]["layer"])] = sortingValue; statements.push(["TOPICTREE", topicTreeColumns, null, topicTreeValues]); } }