Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

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

Add a condition to use calculateOrder function

Also use new function removeDuplicate from tools.js
Link to #4541
parent fbc74bfe
...@@ -427,7 +427,7 @@ Model_loader.prototype = { ...@@ -427,7 +427,7 @@ Model_loader.prototype = {
/** /**
* recalculating the array is sometimes necessary if the analysis and fused_file have diverged. * recalculating the array is sometimes necessary if the analysis and fused_file have diverged.
* @param {Array} arr [description] * @param {Array} arr Order as loaded from analysis file
* @return {Array} [description] * @return {Array} [description]
*/ */
calculateOrder: function(arr) { calculateOrder: function(arr) {
...@@ -475,6 +475,7 @@ Model_loader.prototype = { ...@@ -475,6 +475,7 @@ Model_loader.prototype = {
copySampleFields: function(samples, analysis) { copySampleFields: function(samples, analysis) {
var clone = $.extend({}, samples); var clone = $.extend({}, samples);
if ('id' in analysis) { if ('id' in analysis) {
//replace names, timestamps, order... //replace names, timestamps, order...
dict = this.buildDict(analysis.id, clone.original_names); dict = this.buildDict(analysis.id, clone.original_names);
...@@ -492,15 +493,15 @@ Model_loader.prototype = { ...@@ -492,15 +493,15 @@ Model_loader.prototype = {
} }
// Fix case of error where same timepoint is present multiple time in order // Fix case of error where same timepoint is present multiple time in order
if (clone.order != undefined){
clone.order = removeDuplicate(clone.order)
}
if (analysis.order != undefined){ if (analysis.order != undefined){
analysis.order = analysis.order.filter(function(item, pos) { analysis.order = removeDuplicate(analysis.order)
return analysis.order.indexOf(item) == pos;
})
} }
if (analysis.stock_order != undefined){ if (analysis.stock_order != undefined){
analysis.stock_order = analysis.stock_order.filter(function(item, pos) { analysis.stock_order = removeDuplicate(analysis.stock_order)
return analysis.stock_order.indexOf(item) == pos;
})
} }
if ('order' in analysis && 'stock_order' in analysis) { if ('order' in analysis && 'stock_order' in analysis) {
...@@ -522,8 +523,8 @@ Model_loader.prototype = { ...@@ -522,8 +523,8 @@ Model_loader.prototype = {
clone.order = Array.from(Array(this.samples.number).keys()) clone.order = Array.from(Array(this.samples.number).keys())
clone.stock_order = Array.from(Array(this.samples.number).keys()) clone.stock_order = Array.from(Array(this.samples.number).keys())
} }
} else if ('order' in analysis && !('stock_order' in analysis)) {
// Keep this behavior to ope old samples/analysis } else if ('order' in analysis && !('stock_order' in analysis) && analysis.id.length != clone.original_names.length) {
clone.order = this.calculateOrder(clone.order); clone.order = this.calculateOrder(clone.order);
} }
......
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