Fixing error with NULL id_cat in picto table

parent 62654ffb
......@@ -235,7 +235,7 @@ CREATE TABLE IF NOT EXISTS `picto_exp` (
PRIMARY KEY (`id`),
KEY `id_pic` (`id_pic`)
) 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 @@
tags:
- reset-test-database
with_items:
- categories
- metadata
- categories
- name: Imports application essential data
mysql_db:
......
......@@ -80,7 +80,10 @@ module.exports = {
if (supervisor) {
Picto.find({ category: req.params.id_cat })
.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());
} else {
res.badRequest();
......@@ -279,11 +282,11 @@ module.exports = {
Supervisor.findOne({ id: req.body.owner }).then(function (supervisor) {
var pictoFileName;
var pictoDirectory = sails.config.pictogram.paths.supervisorCustomPictoDirectory;
if (!supervisor) {
throw new Error();
}
pictoFileName = sails.config.pictogram.paths.getSupervisorCustomPictoFileName(supervisor.id);
sails.log.debug("Uploading picto with FileName: " + pictoFileName);
req.file('file').upload({
maxBytes: 1000000,
......
......@@ -1029,7 +1029,7 @@ module.exports = {
if (!req.isSocket) {
sails.log.debug("No socket request for action");
res.badRequest();
res.badRequest()
} else {
sails.log.debug("websockets - room " + sails.hooks.rooms.student(attributes.id_stu));
// BROADCAST to everyone subscribed to this student
......@@ -1055,7 +1055,7 @@ module.exports = {
description: desc
})
.then(function (created) {
res.ok({
res.json({
action: created
});
})
......
......@@ -127,6 +127,7 @@
"loading_pictos": "Loading pictos",
"login": "Log In",
"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}}",
"logout": "Log Out",
"man": "Man",
......
......@@ -127,6 +127,7 @@
"loading_pictos": "Cargando pictos",
"login": "Iniciar sesión",
"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}}",
"logout": "Salir",
"man": "Hombre",
......
......@@ -75,7 +75,10 @@ module.exports.routes = {
'POST /stu/:id_stu/picto/:id_picto': 'StudentController.add_picto',
'POST /stu/subscribe': 'StudentController.subscribe',
'POST /stu/unsubscribe': 'StudentController.unsubscribe',
// Websocket request for propagating actions add, delete, modify...
'POST /stu/vocabulary': 'StudentController.vocabulary',
'POST /stu/action': 'StudentController.action',
'POST /stu/config': 'StudentController.config',
'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