Commit ec9c2ee3 authored by flothoni's avatar flothoni
Browse files

model_loader; add a fix for first analisys file that not include order field

Link to  #4541
parent 0aee6311
Pipeline #193193 passed with stages
in 15 minutes and 19 seconds
......@@ -460,6 +460,13 @@ Model_loader.prototype = {
clone[key][idx] = dict[id][key];
}
}
if (!("order" in analysis)){
// Possible case for first analysis. In this case, don't hide previous samples
analysis.order = []
for (var j = 0; j < analysis.id.length; j++) {
analysis.order.push( j )
}
}
} else {
analysis.id = []
analysis.order = []
......
......@@ -358,7 +358,7 @@ QUnit.test("model: analysis sample data application", function(assert) {
dest = {"original_names": ["1", "4", "2"], "val": ["a", "b", "c"], "lav": ["c", "b", "a"]};
src = {"id": ["1", "2", "3"], "val": ["f", "o", "o"]};
var res = m.copySampleFields(dest, src);
var expected = {"original_names": ["1", "4", "2"], "val": ["f", "b", "o"], "lav": ["c", "b", "a"],"order": [1],"stock_order": [0, 2, 1]};
var expected = {"original_names": ["1", "4", "2"], "val": ["f", "b", "o"], "lav": ["c", "b", "a"],"order": [0, 2, 1],"stock_order": [0, 2, 1]};
assert.deepEqual(res, expected, "copy all relevant fields from analysis to samples");
m.parseJsonData(json_data, 100);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment