Skip to content
Snippets Groups Projects

Auth

Merged Lucas Gabriel Lima requested to merge auth into development
2 files
+ 82
18
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -52,7 +52,12 @@ SimulationSchema.methods.setInclusionGoals = function (g) {
@@ -52,7 +52,12 @@ SimulationSchema.methods.setInclusionGoals = function (g) {
return true;
return true;
};
};
SimulationSchema.methods.setEnrollments = function (e) {
SimulationSchema.methods.setEnrollments = function (e) {
e = JSON.parse(e);
try{
 
e = JSON.parse(e);
 
} catch (err) {
 
return false;
 
}
 
let success = true;
for(let i=0; i<e.length; i++){
for(let i=0; i<e.length; i++){
if(!(e[i] instanceof Array)){
if(!(e[i] instanceof Array)){
return false;
return false;
@@ -60,15 +65,16 @@ SimulationSchema.methods.setEnrollments = function (e) {
@@ -60,15 +65,16 @@ SimulationSchema.methods.setEnrollments = function (e) {
if(e[i].length !== this.time){
if(e[i].length !== this.time){
return false;
return false;
}
}
for(let n of e[i])
e[i].forEach((n, i, array) => {
if(!(n instanceof Number) && (n !== parseInt(n, 10))){
if(n !== parseInt(n, 10)){
return false;
success = false;
}
}
 
});
 
}
}
log.debug("rolou");
if (success) this.enrollments = e;
this.enrollments = e;
return true;
return success;
}
}
SimulationSchema.methods.update = function (property, value) {
SimulationSchema.methods.update = function (property, value) {
let success = true;
let success = true;
@@ -94,8 +100,6 @@ SimulationSchema.methods.update = function (property, value) {
@@ -94,8 +100,6 @@ SimulationSchema.methods.update = function (property, value) {
case 'name':
case 'name':
this.name = value;
this.name = value;
break;
break;
default:
success = false;
}
}
return success;
return success;
};
};
Loading