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
6a9e1c67
authored
Jan 12, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
when student deleted, license is removed
parent
f910fd07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
33 deletions
sails/roles/database/files/pictodb-schema.sql
sails/src/api/models/Student.js
sails/src/api/models/Supervisor.js
sails/roles/database/files/pictodb-schema.sql
View file @
6a9e1c67
...
...
@@ -48,22 +48,6 @@ COMMENT="This table registers and action performed by a user at a given time, al
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `catexp`
--
CREATE
TABLE
IF
NOT
EXISTS
`catexp`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`id_cat`
int
(
11
)
NOT
NULL
,
`lang`
char
(
5
),
`exp`
varchar
(
30
)
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
UNIQUE
(
exp
,
lang
),
CHECK
(
lang
IN
(
'es-es'
,
'en-gb'
,
'en-us'
))
)
COMMENT
=
"Stores the expressions available in several languages for a given category (id_cat)"
;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `method`
--
...
...
@@ -174,20 +158,6 @@ CREATE TABLE IF NOT EXISTS `picto` (
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_unicode_ci
AUTO_INCREMENT
=
104142
COMMENT
=
"Main information about a pictogram, either coming from a source like Symbolstix or added by a supervisor. It can belongs to a category (id_cat)"
;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `pictocat`
--
CREATE
TABLE
IF
NOT
EXISTS
`pictocat`
(
`id`
int
(
11
)
PRIMARY
KEY
,
`id_supercat`
int
(
11
)
)
COMMENT
=
"Identifies a category, which, itself, may belong to another category"
;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `picto_acl`
-- NOT IN USE (candidate for removal)
...
...
sails/src/api/models/Student.js
View file @
6a9e1c67
...
...
@@ -245,7 +245,7 @@ module.exports = {
beforeCreate
:
function
(
attrs
,
next
)
{
attrs
.
attributes
=
Student
.
getValidAttributes
(
attrs
.
attributes
);
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
attrs
.
pic
=
sails
.
config
.
pictogram
.
urls
.
getStudentAvatarUrl
()
;
attrs
.
pic
=
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
;
next
();
},
...
...
@@ -519,7 +519,9 @@ module.exports = {
username
:
Math
.
floor
((
Math
.
random
()
*
100000000
)
+
1
)
+
"_"
+
student
.
username
,
id_off
:
null
})
.
then
((
updated
)
=>
{
cb
()})
.
then
((
updated
)
=>
{
License
.
destroy
({
id_stu
:
id_stu
}).
exec
(
cb
);
})
.
catch
((
err
)
=>
{
cb
(
err
)});
});
}
...
...
sails/src/api/models/Supervisor.js
View file @
6a9e1c67
...
...
@@ -235,7 +235,7 @@ module.exports = {
async
.
eachSeries
(
stuSups
,
function
(
stuSup
,
next_cb
)
{
// Filter logically deleted students
if
(
stuSup
.
student
.
office
==
null
)
next_cb
();
return
next_cb
();
// set current method and instruction if any
Student
.
findOne
(
stuSup
.
student
.
id
)
...
...
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