Skip to content

Commit

Permalink
Added a way to deal with changed operation types when loading plans.
Browse files Browse the repository at this point in the history
  • Loading branch information
klavins committed Sep 20, 2017
1 parent 1127d0c commit 18302bf
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions app/assets/javascripts/models/marshall.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ AQ.Operation.record_methods.marshall = function() {

var input_index = 0, output_index = 0;

op.field_values = aq.collect(op.field_values,(fv) => {
var updated_field_values = [];

aq.each(op.field_values,(fv) => {

var ufv = AQ.FieldValue.record(fv);
AQ.id_map[fv.id] = ufv.rid;
Expand All @@ -71,18 +73,30 @@ AQ.Operation.record_methods.marshall = function() {
}
});

if ( ufv.role == 'input' ) { // these indices are for methods that need to know
ufv.index = input_index++; // which input the fv is (e.g. first, second, etc.)
}
if ( !ufv.field_type ) {

alert("Field type for " + ufv.role + " '" + ufv.name + "' of '" + op.operation_type.name + "' is undefined. " +
"This i/o has been dropped. " +
"The operation type may have changed since this plan was last saved and you probably should not trust this plan.")

if ( ufv.role == 'output' ) {
ufv.index = output_index++;
}
} else {

if ( ufv.role == 'input' ) { // these indices are for methods that need to know
ufv.index = input_index++; // which input the fv is (e.g. first, second, etc.)
}

return ufv;
if ( ufv.role == 'output' ) {
ufv.index = output_index++;
}

updated_field_values.push(ufv);

}

})

op.field_values = updated_field_values;

aq.each(op.field_values, fv => {

if ( fv.child_sample_id ) {
Expand Down

0 comments on commit 18302bf

Please sign in to comment.