Skip to content
Snippets Groups Projects
Commit ad42bd64 authored by juanf's avatar juanf
Browse files

SSDM-2732 : Ordering System, fixing validation for annotations.

SVN: 36846
parent 201f3467
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,9 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show ...@@ -39,6 +39,9 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show
// //
this.isValid = function() { this.isValid = function() {
if(sampleTypeHints) { if(sampleTypeHints) {
var sampleFromIdxOwner = mainController.currentView._sampleFormModel.sample;
var allOwnerAnnotations = FormUtil.getAnnotationsFromSample(sampleFromIdxOwner);
for(var typeIdx = 0; typeIdx < sampleTypeHints.length; typeIdx++) { for(var typeIdx = 0; typeIdx < sampleTypeHints.length; typeIdx++) {
var sampleTypeHint = sampleTypeHints[typeIdx]; var sampleTypeHint = sampleTypeHints[typeIdx];
var sampleTypeCode = sampleTypeHint["TYPE"]; var sampleTypeCode = sampleTypeHint["TYPE"];
...@@ -52,9 +55,23 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show ...@@ -52,9 +55,23 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show
if(sampleTypeCount > 0) { if(sampleTypeCount > 0) {
for(var sampleIdx = 0; sampleIdx < linksModel.samplesByType[sampleTypeCode].length; sampleIdx++) { for(var sampleIdx = 0; sampleIdx < linksModel.samplesByType[sampleTypeCode].length; sampleIdx++) {
var sampleWithAnnotations = linksModel.samplesByType[sampleTypeCode][sampleIdx]; var sampleFromIdx = linksModel.samplesByType[sampleTypeCode][sampleIdx];
for(var annotIdx = 0; annotIdx < sampleTypeAnnotations.length; annotIdx++) { var sampleFromIdxAnnotations = null;
//TO-DO, Not enough information to validate required annotations here
if(allOwnerAnnotations && allOwnerAnnotations[sampleFromIdx.permId]) {
sampleFromIdxAnnotations = allOwnerAnnotations[sampleFromIdx.permId];
}
if(sampleFromIdxAnnotations) {
for(var annotIdx = 0; annotIdx < sampleTypeAnnotations.length; annotIdx++) {
var sampleTypeAnnotation = sampleTypeAnnotations[annotIdx];
var sampleTypeAnnotationType = sampleTypeAnnotation["TYPE"];
var sampleTypeAnnotationIsMandatory = sampleTypeAnnotation["MANDATORY"];
if(sampleTypeAnnotationIsMandatory && !sampleFromIdxAnnotations[sampleTypeAnnotationType]) {
Util.showError("You are missing an annotation " + sampleTypeAnnotationType + " on " + sampleFromIdx.code +".");
return false;
}
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment