issue #676 fixed

parent 9a113ef3
......@@ -79,6 +79,10 @@ module.exports = {
var l = [];
var fs = require('fs');
// return empty for category 0 (that represents category pictos and all custom pictos)
if (req.params.id_cat == 0)
return res.ok(l);
Supervisor.findOne({ id: req.params.id }).then(function (supervisor) {
if (supervisor) {
Picto.find({ category: req.params.id_cat })
......@@ -103,12 +107,12 @@ module.exports = {
function (err) { // loop has end
if (err) throw err;
sails.log.debug(pictos.length + " pictos sent for category " + req.params.id_cat + " in language " + supervisor.lang);
res.ok(l);
return res.ok(l);
}); // end async.eachSeries
})
.catch(() => res.badRequest());
} else {
res.badRequest();
return res.badRequest();
}
})
.catch(() => res.serverError());
......
/* global Supervisor, sails */
const lodash = require('lodash');
/**
* supervisor.js
......
......@@ -63,7 +63,6 @@ dashboardControllers.controller('AddPictoCtrl', function (
//
// Load pictos from owned by the actual supervisor
// TEST --> change with real supervisor pictos
//
$scope.load_own_pictos = function () {
$scope.source = 'ownpictos';
......
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