#393 legend fixed

parent 9c7a5da6
Showing with 2 additions and 7 deletions
...@@ -572,17 +572,12 @@ module.exports = { ...@@ -572,17 +572,12 @@ module.exports = {
}, },
/* /*
* Updates legend in student pictos * Updates legend in all student pictos for one id_grid
* legend is not updated for categories
*/ */
update_legend: function(id_grid, legend_value, cb) { update_legend: function(id_grid, legend_value, cb) {
var query='UPDATE stu_picto' + var query='UPDATE stu_picto' +
' SET attributes = json_set(attributes, \'$.legend\',\''+legend_value+'\')' + ' SET attributes = json_set(attributes, \'$.legend\',\''+legend_value+'\')' +
' WHERE id_grid=' + id_grid + ' AND ' + ' WHERE id_grid=' + id_grid + ';'
' (json_extract(attributes, \'$.id_cat\') LIKE \'null\' AND ' +
' json_extract(attributes, \'$.coord_y\') = 0 OR ' +
' json_extract(attributes, \'$.id_cat\') NOT LIKE \'null\' AND ' +
' json_extract(attributes, \'$.coord_y\') >= 0);'
; ;
StuPicto.query(query, function(err, result) { StuPicto.query(query, function(err, result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment