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
3916ba40
authored
Aug 14, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on issue
#305
parent
be2d90aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
13 deletions
sails/src/api/controllers/SupervisorController.js
sails/src/api/models/Supervisor.js
sails/src/assets/scripts/modules/login/controllers/login.js
sails/src/api/controllers/SupervisorController.js
View file @
3916ba40
...
...
@@ -659,7 +659,8 @@ module.exports = {
Supervisor
.
students
(
req
.
params
.
id
,
function
(
err
,
stus
)
{
if
(
err
)
throw
err
;
return
res
.
ok
(
stus
);
});
})
.
catch
((
err
)
=>
res
.
serverError
(
err
));
},
/*
...
...
sails/src/api/models/Supervisor.js
View file @
3916ba40
...
...
@@ -221,6 +221,9 @@ module.exports = {
);
},
/**
* Returns the list of students linked to the supervisor
*/
students
:
function
(
id
,
callback
)
{
var
l
=
[];
...
...
@@ -231,19 +234,13 @@ module.exports = {
// Get all stu_sup relations
var
stuSups
=
StuSup
.
find
({
supervisor
:
id
})
.
populate
(
'student'
)
.
then
(
function
(
stuSups
)
{
if
(
!
stuSups
||
stuSups
.
length
==
0
)
return
[];
return
stuSups
;
})
.
catch
((
err
)
=>
{
throw
err
;
});
.
populate
(
'student'
);
return
[
sup
,
stuSups
];
})
.
spread
(
function
(
sup
,
stuSups
)
{
if
(
!
stuSups
||
stuSups
.
length
==
0
)
return
throw
new
Error
(
"No students"
);
async
.
eachSeries
(
stuSups
,
function
(
stuSup
,
next_cb
)
{
// set current method and instruction if any
Student
.
findOne
(
stuSup
.
student
.
id
)
...
...
@@ -261,11 +258,11 @@ module.exports = {
});
},
function
(
err
)
{
callback
(
err
,
l
);
return
callback
(
err
,
l
);
});
})
.
catch
((
err
)
=>
{
callback
(
err
,
l
);
return
callback
(
err
,
l
);
});
// end Supervisor.findOne
},
...
...
sails/src/assets/scripts/modules/login/controllers/login.js
View file @
3916ba40
...
...
@@ -62,7 +62,7 @@ function LoginCtrl(
.
success
(
function
(
data
)
{
$window
.
sessionStorage
.
token
=
data
.
token
;
//User data correct
//
User data correct
if
(
data
.
user
)
{
// Adapt language en-us to en-gb (the latter is the one supported for 'en')
if
(
data
.
user
.
lang
===
'en-us'
)
...
...
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