Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
636abc32
authored
Jan 22, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
solved a pair of issues
parent
4881eaf6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/SupervisorController.js
sails/src/api/controllers/StudentController.js
View file @
636abc32
...
...
@@ -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 "
+
room
s
[
i
]);
}
res
.
json
({
...
...
sails/src/api/controllers/SupervisorController.js
View file @
636abc32
...
...
@@ -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
);
}
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment