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
fb533e42
authored
Nov 06, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
minor change in new-grid-update
parent
191f71c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
sails/roles/database/files/new-grid-system-adapt.sql
sails/roles/database/files/new-grid-system-adapt.sql
View file @
fb533e42
...
...
@@ -35,17 +35,16 @@ BEGIN
END
IF
;
-- Carga las variables desde el JSON para free_category_coord e id_cat
IF
_attributes
->>
"$.free_category_coord_x"
=
'null'
THEN
SET
_free_category_coord_x
=
NULL
;
ELSE
SELECT
_attributes
->>
"$.free_category_coord_x"
INTO
_free_category_coord_x
;
END
IF
;
IF
_attributes
->>
"$.
_
free_category_coord_y"
=
'null'
THEN
IF
_attributes
->>
"$.free_category_coord_y"
=
'null'
THEN
SET
_free_category_coord_y
=
NULL
;
ELSE
SELECT
_attributes
->>
"$.
_
free_category_coord_y"
INTO
_free_category_coord_y
;
SELECT
_attributes
->>
"$.free_category_coord_y"
INTO
_free_category_coord_y
;
END
IF
;
-- Esto hay que hacerlo porque el null procediente del JSON para id_cat lo reconoce como un literal
...
...
@@ -55,16 +54,22 @@ BEGIN
SELECT
_attributes
->>
"$.id_cat"
INTO
_id_cat
;
END
IF
;
-- Ya no nos hacen falta estos atributos
UPDATE
stu_picto
SET
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.free_category_coord_x'
),
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.free_category_coord_y'
)
WHERE
id
=
_id_stu_picto
;
-- Pictogramas que estan en escenas sin categorias
IF
(
_free_category_coord_x
IS
NOT
NULL
)
OR
(
_free_category_coord_y
IS
NOT
NULL
)
THEN
-- Pasa las coordenadas libres a coord_x y coord_y, ademas elimina variables antiguas
UPDATE
stu_picto
_id_cat
UPDATE
stu_picto
SET
`attributes`
=
JSON_REPLACE
(
`attributes`
,
'$.coord_x'
,
_free_category_coord_x
),
`attributes`
=
JSON_REPLACE
(
`attributes`
,
'$.coord_y'
,
_free_category_coord_y
),
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.free_category_coord_x'
),
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.free_category_coord_y'
)
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.id_cat'
)
WHERE
id
=
_id_stu_picto
;
-- Pictogramas que estan en escenas con categorias
...
...
@@ -96,11 +101,6 @@ BEGIN
SET
id_grid
=
_grid_id
WHERE
id
=
_id_stu_picto
;
-- Se pone id_cat a NULL, puesto que dicho valor no lo volveremos a necesitar
UPDATE
stu_picto
SET
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.id_cat'
)
WHERE
id
=
_id_stu_picto
;
END
IF
;
-- La escena no existe, la creo, la asocio con el picto padre y asocio el pictograma actual a dicha escena
...
...
@@ -121,12 +121,6 @@ BEGIN
UPDATE
stu_picto
SET
id_grid
=
LID
WHERE
id
=
_id_stu_picto
;
-- Se pone id_cat a NULL, puesto que dicho valor no lo volveremos a necesitar
UPDATE
stu_picto
SET
`attributes`
=
JSON_REMOVE
(
`attributes`
,
'$.id_cat'
)
WHERE
id
=
_id_stu_picto
;
END
IF
;
END
IF
;
...
...
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