Skip to content

Commit

Permalink
handle spaces in pipelinee element names and parameter names and values"
Browse files Browse the repository at this point in the history
  • Loading branch information
RLeenings committed Apr 20, 2021
1 parent 067ba92 commit a39346c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/preprocessing/configInterpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ function normalizeConfig(human_readable_config, pipeline_structure) {
for (let [param_key, param_value] of Object.entries(human_readable_config)) {

// find belonging element in pipeline
param_key = param_key.replace(" ", "");
let curr_obj = pipeline_stub;
let splitted_param_key = param_key.split("__");
(splitted_param_key).forEach(name =>{
name = name.replace(" ", "");
curr_obj = curr_obj.value.filter(obj => obj.name == name)[0]
});

Expand All @@ -145,12 +147,17 @@ function normalizeConfig(human_readable_config, pipeline_structure) {
let splitted_param_value = parameter.split("__");
if (splitted_param_value.length > 1){
for (let i = 0; i < splitted_param_value.length - 1; i++) {
param_obj = param_obj.value.filter(obj => obj.name == splitted_param_value[i])[0]
let search_name = splitted_param_value[i].replace(" ", "");
param_obj = param_obj.value.filter(obj => obj.name == search_name)[0];
}
parameter = splitted_param_value[splitted_param_value.length -1];
}

let outputObject = {...parseParameter(parameter), ...{type: "value"}};
if(!param_obj){
console.log("param_obj is None");
console.log(valueArray);
}
param_obj.value.push(outputObject)
})
}
Expand Down Expand Up @@ -276,6 +283,7 @@ Number.prototype.countDecimals = function () {
*/
function parseParameter(parameter){
let outputObject = Object();
parameter.replace(" ", "");
let splitPair = parameter.split("=", 2);
if (splitPair.length == 1) { // Handle standalone values
splitPair[1] = "";
Expand Down

0 comments on commit a39346c

Please sign in to comment.