Commit a4a4bc8c authored by flothoni's avatar flothoni Committed by Mikaël Salson
Browse files

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

Link to  #4541
parent 22d27789
Pipeline #195831 failed with stages
in 22 minutes and 30 seconds
......@@ -464,6 +464,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