Fixing error with NULL id_cat in picto table

parent 62654ffb
...@@ -235,7 +235,7 @@ CREATE TABLE IF NOT EXISTS `picto_exp` ( ...@@ -235,7 +235,7 @@ CREATE TABLE IF NOT EXISTS `picto_exp` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_pic` (`id_pic`) KEY `id_pic` (`id_pic`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=72565 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=72565
COMMENT="Expression (text label) for a picto in different languages. This is used by the TTS engine"; COMMENT="Expression (text label) for a picto (or a category) in different languages. This is used by the TTS engine";
-- -------------------------------------------------------- -- --------------------------------------------------------
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
tags: tags:
- reset-test-database - reset-test-database
with_items: with_items:
- categories
- metadata - metadata
- categories
- name: Imports application essential data - name: Imports application essential data
mysql_db: mysql_db:
......
...@@ -80,7 +80,10 @@ module.exports = { ...@@ -80,7 +80,10 @@ module.exports = {
if (supervisor) { if (supervisor) {
Picto.find({ category: req.params.id_cat }) Picto.find({ category: req.params.id_cat })
.populate('expressions', { lang: supervisor.lang }) .populate('expressions', { lang: supervisor.lang })
.then(pictos => res.ok(pictos)) .then(function (pictos) {
sails.log.debug(pictos.length + " pictos sent for category " + req.params.id_cat + " in language " + supervisor.lang);
res.ok(pictos);
})
.catch(() => res.badRequest()); .catch(() => res.badRequest());
} else { } else {
res.badRequest(); res.badRequest();
...@@ -279,11 +282,11 @@ module.exports = { ...@@ -279,11 +282,11 @@ module.exports = {
Supervisor.findOne({ id: req.body.owner }).then(function (supervisor) { Supervisor.findOne({ id: req.body.owner }).then(function (supervisor) {
var pictoFileName; var pictoFileName;
var pictoDirectory = sails.config.pictogram.paths.supervisorCustomPictoDirectory; var pictoDirectory = sails.config.pictogram.paths.supervisorCustomPictoDirectory;
if (!supervisor) { if (!supervisor) {
throw new Error(); throw new Error();
} }
pictoFileName = sails.config.pictogram.paths.getSupervisorCustomPictoFileName(supervisor.id); pictoFileName = sails.config.pictogram.paths.getSupervisorCustomPictoFileName(supervisor.id);
sails.log.debug("Uploading picto with FileName: " + pictoFileName);
req.file('file').upload({ req.file('file').upload({
maxBytes: 1000000, maxBytes: 1000000,
......
...@@ -1029,7 +1029,7 @@ module.exports = { ...@@ -1029,7 +1029,7 @@ module.exports = {
if (!req.isSocket) { if (!req.isSocket) {
sails.log.debug("No socket request for action"); sails.log.debug("No socket request for action");
res.badRequest(); res.badRequest()
} else { } else {
sails.log.debug("websockets - room " + sails.hooks.rooms.student(attributes.id_stu)); sails.log.debug("websockets - room " + sails.hooks.rooms.student(attributes.id_stu));
// BROADCAST to everyone subscribed to this student // BROADCAST to everyone subscribed to this student
...@@ -1055,7 +1055,7 @@ module.exports = { ...@@ -1055,7 +1055,7 @@ module.exports = {
description: desc description: desc
}) })
.then(function (created) { .then(function (created) {
res.ok({ res.json({
action: created action: created
}); });
}) })
......
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
"loading_pictos": "Loading pictos", "loading_pictos": "Loading pictos",
"login": "Log In", "login": "Log In",
"login_fail": "Invalid user or password", "login_fail": "Invalid user or password",
"login_footer": "Pictogram is a product by <a href='http://www.yottacode.com'>Yottacode S.L.</a> for Augmentative and Alternative Communication, loaded with more than 20,000 images from the <a href=''>SymbolStix</a> collection, in several languages. From here, you will be able to manage devices with official <i>Pictogram Tablet</i> app installed.",
"login_success": "Login succeed. Welcome {{name}}", "login_success": "Login succeed. Welcome {{name}}",
"logout": "Log Out", "logout": "Log Out",
"man": "Man", "man": "Man",
......
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
"loading_pictos": "Cargando pictos", "loading_pictos": "Cargando pictos",
"login": "Iniciar sesión", "login": "Iniciar sesión",
"login_fail": "Usuario o contraseña incorrectos", "login_fail": "Usuario o contraseña incorrectos",
"login_footer": "Pictogram es un producto de <a href='http://www.yottacode.com'>Yottacode S.L.</a> para Comunicación Aumentativa y Alternativa, cargado con más los más de 20,000 pictogramas de <a href=''>SymbolStix</a>, en varios idiomas. Desde aquí podrás gestionar los dispositivos que dispongan de la app oficial <i>Pictogram Tablet</i>.",
"login_success": "Login correcto. Bienvenido {{name}}", "login_success": "Login correcto. Bienvenido {{name}}",
"logout": "Salir", "logout": "Salir",
"man": "Hombre", "man": "Hombre",
......
...@@ -75,7 +75,10 @@ module.exports.routes = { ...@@ -75,7 +75,10 @@ module.exports.routes = {
'POST /stu/:id_stu/picto/:id_picto': 'StudentController.add_picto', 'POST /stu/:id_stu/picto/:id_picto': 'StudentController.add_picto',
'POST /stu/subscribe': 'StudentController.subscribe', 'POST /stu/subscribe': 'StudentController.subscribe',
'POST /stu/unsubscribe': 'StudentController.unsubscribe', 'POST /stu/unsubscribe': 'StudentController.unsubscribe',
// Websocket request for propagating actions add, delete, modify...
'POST /stu/vocabulary': 'StudentController.vocabulary', 'POST /stu/vocabulary': 'StudentController.vocabulary',
'POST /stu/action': 'StudentController.action', 'POST /stu/action': 'StudentController.action',
'POST /stu/config': 'StudentController.config', 'POST /stu/config': 'StudentController.config',
'POST /stu/actions_batch': 'StudentController.actions_batch', 'POST /stu/actions_batch': 'StudentController.actions_batch',
......
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