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
7e50d3d1
authored
Apr 21, 2017
by
Arturo Montejo Ráez
1
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue
#126
implemented
parent
b5d0af59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/SupervisorController.js
sails/src/api/controllers/StudentController.js
View file @
7e50d3d1
...
...
@@ -130,7 +130,7 @@ module.exports = {
"tape_background": "#00ffff",
"delivery": 0
}
}
}
*/
getInfo
:
function
(
req
,
res
)
{
Student
.
findOne
({
id
:
req
.
params
.
id_stu
})
...
...
@@ -169,6 +169,20 @@ module.exports = {
if
(
student
.
supervision
==
-
1
)
// should not hace access!!!
return
res
.
forbidden
(
"Access to this student should not be granted to you"
);
// Promisify asynchronous call to Student.supervisors
var
supervisors
=
new
Promise
(
function
(
resolve
,
reject
)
{
Student
.
supervisors
(
student
.
id
,
(
err
,
ss
)
=>
{
if
(
err
)
return
reject
(
err
);
return
resolve
(
ss
);
});
});
return
[
student
,
supervisors
];
})
.
spread
((
student
,
supervisors
)
=>
{
student
.
supervisors
=
supervisors
;
console
.
log
(
JSON
.
stringify
(
supervisors
));
console
.
log
(
JSON
.
stringify
(
student
.
supervisors
));
return
res
.
ok
(
student
);
})
.
catch
(
function
(
err
)
{
...
...
sails/src/api/controllers/SupervisorController.js
View file @
7e50d3d1
...
...
@@ -105,6 +105,8 @@ module.exports = {
if
(
!
supervisor
.
isSupAdmin
&&
!
stuSup
)
throw
new
Error
(
"Supervisor without students"
);
supervisor
.
isSup
=
true
;
return
res
.
ok
({
user
:
supervisor
,
server_time
:
(
new
Date
()).
getTime
(),
...
...
Arturo Montejo Ráez
@amontejo
mentioned in issue
#142 (closed)
May 05, 2017
mentioned in issue
#142 (closed)
mentioned in issue #142
Toggle commit list
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