fixed problem with missing students in office admin list

parent 4ba9dd64
Showing with 3 additions and 3 deletions
......@@ -259,6 +259,7 @@ module.exports = {
function (err) { // loop has end
// Get all students from the office if user is administrator
if (sup.office && sup.office.admin == sup.id) {
var officeStudents;
Student.find({ office: sup.office.id }).populate('lastInstruction')
.then(function (officeStudents) {
......@@ -268,14 +269,13 @@ module.exports = {
student.current_instruction = student.lastInstruction[0] ? student.lastInstruction[0].ins_name : "no_instruction";
return student;
});
l.concat(officeStudents);
callback(null, lodash.uniq(l, false, 'id'));
l = l.concat(officeStudents);
callback(err, lodash.uniq(l, false, 'id'));
})
.catch(function (err) {
callback(err, l);
});
}
callback(err, l);
}); // end async.eachSeries
})
.catch((err) => {
......
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