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
be2d90aa
authored
Aug 14, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
refactorized default method string
parent
55bd53a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
19 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/models/Student.js
sails/src/api/models/Supervisor.js
sails/src/assets/scripts/modules/login/controllers/login.js
sails/src/api/controllers/StudentController.js
View file @
be2d90aa
...
...
@@ -139,15 +139,6 @@ module.exports = {
if
(
!
student
)
throw
new
Error
(
"student not found"
);
student
.
current_method
=
student
.
lastInstruction
[
0
]
?
student
.
lastInstruction
[
0
].
met_name
:
"no_method"
;
student
.
current_instruction
=
student
.
lastInstruction
[
0
]
?
student
.
lastInstruction
[
0
].
ins_name
:
"no_instruction"
;
// determine supervision level of the requester on the student
var
stu_sup
=
StuSup
.
findOne
({
id_stu
:
student
.
id
,
id_sup
:
req
.
token
.
id
});
return
[
student
,
stu_sup
];
})
.
spread
(
function
(
student
,
stu_sup
)
{
// Promisify asynchronous call to Student.supervisors
var
supervisors
=
new
Promise
(
function
(
resolve
,
reject
)
{
Student
.
validSupervisors
(
student
.
id
,
req
.
token
.
id
,
function
(
err
,
ss
)
{
...
...
sails/src/api/models/Student.js
View file @
be2d90aa
...
...
@@ -116,6 +116,8 @@ module.exports = {
student
.
license
.
isOfficial
=
student
.
license
.
type
==
'official'
;
}
student
.
attributes
=
Student
.
getValidAttributes
(
student
.
attributes
);
student
.
current_method
=
student
.
lastInstruction
[
0
]
?
student
.
lastInstruction
[
0
].
met_name
:
"no_method"
;
student
.
current_instruction
=
student
.
lastInstruction
[
0
]
?
student
.
lastInstruction
[
0
].
ins_name
:
"no_instruction"
;
delete
student
.
password
;
return
student
;
},
...
...
sails/src/api/models/Supervisor.js
View file @
be2d90aa
...
...
@@ -126,6 +126,11 @@ module.exports = {
toJSON
:
function
()
{
var
supervisor
=
this
.
toObject
();
supervisor
.
pic
=
sails
.
config
.
pictogram
.
urls
.
getSupervisorAvatarUrl
(
supervisor
.
pic
);
supervisor
.
isTutor
=
supervisor
.
role
==
'tutor'
;
supervisor
.
isTherapist
=
supervisor
.
role
==
'therapist'
;
supervisor
.
isOffice
=
supervisor
.
role
==
'office'
;
supervisor
.
isAdmin
=
supervisor
.
role
==
'admin'
;
delete
supervisor
.
password
;
return
supervisor
;
},
...
...
@@ -249,8 +254,6 @@ module.exports = {
return
next_cb
();
s
=
s
.
toJSON
();
s
.
current_method
=
s
.
lastInstruction
[
0
]
?
s
.
lastInstruction
[
0
].
met_name
:
"no_method"
;
s
.
current_instruction
=
s
.
lastInstruction
[
0
]
?
s
.
lastInstruction
[
0
].
ins_name
:
"no_instruction"
;
if
(
!
s
.
license
)
return
next_cb
();
l
.
push
(
s
);
...
...
@@ -295,8 +298,6 @@ module.exports = {
return
next_cb
();
s
=
s
.
toJSON
();
s
.
current_method
=
s
.
lastInstruction
[
0
]
?
s
.
lastInstruction
[
0
].
met_name
:
"no_method"
;
s
.
current_instruction
=
s
.
lastInstruction
[
0
]
?
s
.
lastInstruction
[
0
].
ins_name
:
"no_instruction"
;
if
(
!
s
.
license
)
return
next_cb
();
l
.
push
(
s
);
...
...
sails/src/assets/scripts/modules/login/controllers/login.js
View file @
be2d90aa
...
...
@@ -67,12 +67,6 @@ function LoginCtrl(
// Adapt language en-us to en-gb (the latter is the one supported for 'en')
if
(
data
.
user
.
lang
===
'en-us'
)
data
.
user
.
lang
=
'en-gb'
;
data
.
user
.
isTutor
=
data
.
user
.
role
==
'tutor'
;
data
.
user
.
isTherapist
=
data
.
user
.
role
==
'therapist'
;
data
.
user
.
isOffice
=
data
.
user
.
role
==
'office'
;
data
.
user
.
isAdmin
=
data
.
user
.
role
==
'admin'
;
$scope
.
lang
=
data
.
user
.
lang
;
$translate
.
use
(
$scope
.
lang
);
}
else
{
...
...
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