fixing id_sup entries in stu_sup without related supervisor

parent 3f89a158
Showing with 2 additions and 2 deletions
...@@ -127,7 +127,7 @@ module.exports = { ...@@ -127,7 +127,7 @@ module.exports = {
else { else {
student.current_method = "no_method"; student.current_method = "no_method";
student.current_instruction = "no_instruction"; student.current_instruction = "no_instruction";
} }
delete student.password; delete student.password;
return student; return student;
...@@ -321,7 +321,7 @@ module.exports = { ...@@ -321,7 +321,7 @@ module.exports = {
if (!supOffs || supOffs.length == 0) { if (!supOffs || supOffs.length == 0) {
// if we get here, only the requester being directly related to the // if we get here, only the requester being directly related to the
// student is valid // student is valid
var supIdx = stuSups.findIndex(x => x.supervisor.id == id_sup); var supIdx = stuSups.findIndex(x => x.supervisor && x.supervisor.id == id_sup);
if (supIdx >= 0) if (supIdx >= 0)
return callback(null, [stuSups[supIdx].supervisor]); return callback(null, [stuSups[supIdx].supervisor]);
throw new Error("No supervisors related"); throw new Error("No supervisors related");
......
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