insert office in the list of valid supervisors

parent 3f45eb3e
Showing with 7 additions and 2 deletions
......@@ -329,12 +329,17 @@ module.exports = {
// filter null entries and map them to the supervisor object
var ss = _.compact(_.compact(stuSups).map(x => x.supervisor));
var so = _.compact(_.compact(supOffs).map(x => x.supervisor));
var ss = _.compact(_.compact(stuSups).map(x => x.supervisor)); // supervisors linked to student
var so = _.compact(_.compact(supOffs).map(x => x.supervisor)); // supervisors linked to office
// filter from the second list those found in the first list
var sups = so.filter(a => ss.findIndex(b => b.id == a.id) >= 0);
return [sups, Supervisor.find(id_sup)];
})
.spread((sups, me) => {
// The requester is an office, so it has to be appended to the list of valid supervisors
sups.append(me);
return callback(null, sups);
})
.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