solved a pair of issues

parent 4881eaf6
......@@ -685,7 +685,7 @@ module.exports = {
// Leave all rooms
for(var i=0; i<rooms.length; i++){
sails.sockets.leave(req.socket, rooms[i]);
sails.log.debug("Unsusbscribe from room " + room[i]);
sails.log.debug("Unsusbscribe from room " + rooms[i]);
}
res.json({
......
......@@ -199,6 +199,7 @@ module.exports = {
// First, let's get the list of students of the supervisor
//
function (cb) {
console.log("getting supervisor's students");
StuSup.find({supervisor: idSup}).populate('student').exec(function(err, stusups){
if (err) return cb(err);
if (stusups) {
......@@ -224,6 +225,7 @@ module.exports = {
// the list of students
//
function (cb) {
console.log("getting office students");
if (req.token.isSupAdmin) {
Student.find({office: req.token.office.id }).exec(function(err, students){
if (err) return cb(err);
......@@ -231,6 +233,7 @@ module.exports = {
var l_stu_id = _.pluck(l_stu, 'id'); // get a list of supervised student ids
if (students) {
async.eachSeries(students, function(student, next) {
console.log("student " + JSON.stringify(student));
if (_.indexOf(l_stu_id, student.id) == -1) { // a new student, let's add it
// no supervised
student.supervision = 0;
......@@ -244,12 +247,13 @@ module.exports = {
});
} else cb();
});
}
} else cb();
},
//
// Populate students with methods
//
function (cb) {
console.log("assigning methods");
async.eachSeries(l_stu, function(student, next) {
VStuLastInstruction.findOne(student.id).exec(function(err, row) {
if (err) {
......@@ -274,7 +278,8 @@ module.exports = {
}
],
function(err) { // All steps done! return list of students if no error
if (err) return json(500, {err: err});
console.log("done!");
if (err) return res.json(500, {err: err});
return res.json(l_stu);
}
);
......
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