working on issue #305

parent be2d90aa
......@@ -659,7 +659,8 @@ module.exports = {
Supervisor.students(req.params.id, function (err, stus) {
if (err) throw err;
return res.ok(stus);
});
})
.catch((err) => res.serverError(err));
},
/*
......
......@@ -221,6 +221,9 @@ module.exports = {
);
},
/**
* Returns the list of students linked to the supervisor
*/
students: function(id, callback) {
var l = [];
......@@ -231,19 +234,13 @@ module.exports = {
// Get all stu_sup relations
var stuSups = StuSup.find({ supervisor: id })
.populate('student')
.then(function (stuSups) {
if (!stuSups || stuSups.length == 0)
return [];
return stuSups;
})
.catch((err) => {
throw err;
});
.populate('student');
return [sup, stuSups];
})
.spread(function (sup, stuSups) {
if (!stuSups || stuSups.length == 0)
return throw new Error("No students");
async.eachSeries(stuSups, function(stuSup, next_cb) {
// set current method and instruction if any
Student.findOne(stuSup.student.id)
......@@ -261,11 +258,11 @@ module.exports = {
});
},
function (err) {
callback(err, l);
return callback(err, l);
});
})
.catch((err) => {
callback(err, l);
return callback(err, l);
}); // end Supervisor.findOne
},
......
......@@ -62,7 +62,7 @@ function LoginCtrl(
.success(function (data) {
$window.sessionStorage.token = data.token;
//User data correct
// User data correct
if (data.user) {
// Adapt language en-us to en-gb (the latter is the one supported for 'en')
if (data.user.lang === 'en-us')
......
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 sign in to comment