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
75e90742
authored
Aug 14, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixing error with null licenses
parent
710f0a3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
sails/src/api/models/License.js
sails/src/api/models/Student.js
sails/src/api/models/License.js
View file @
75e90742
...
...
@@ -70,7 +70,9 @@ module.exports = {
Class methods
*/
hasExpired
:
function
(
license
)
{
return
(
new
Date
(
license
.
expiration_ts
)
-
new
Date
()
<
0
);
if
(
license
)
return
(
new
Date
(
license
.
expiration_ts
)
-
new
Date
()
<
0
);
else
return
true
;
},
/**
...
...
sails/src/api/models/Student.js
View file @
75e90742
...
...
@@ -109,12 +109,12 @@ module.exports = {
toJSON
:
function
()
{
var
student
=
this
.
toObject
();
student
.
pic
=
sails
.
config
.
pictogram
.
urls
.
getStudentAvatarUrl
(
student
.
pic
);
if
(
student
.
license
)
{
student
.
license
=
student
.
license
[
0
]
?
student
.
license
[
0
]
:
null
;
if
(
student
.
license
&&
student
.
license
[
0
]
)
{
student
.
license
=
student
.
license
[
0
];
student
.
license
.
isValid
=
!
License
.
hasExpired
(
student
.
license
);
student
.
license
.
isTrial
=
student
.
license
.
type
==
'trial'
;
student
.
license
.
isOfficial
=
student
.
license
.
type
==
'official'
;
}
}
else
student
.
license
=
null
;
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"
;
...
...
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