Commit a9ee3961 by Fernando Martínez Santiago Committed by root

bug #531 fixed. It's required to reinstall the database triggers to take effect of this patch

parent fe69eda6
...@@ -89,7 +89,7 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co ...@@ -89,7 +89,7 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co
(154, 11523,NULL, 1, 1, '#FE9A2E'), -- Rooms (154, 11523,NULL, 1, 1, '#FE9A2E'), -- Rooms
(155, 12303,NULL, 4, 1, '#F4FA58'), -- Clasroom items (155, 12303,NULL, 4, 1, '#F4FA58'), -- Clasroom items
(156, 5393, NULL, 4, 0, '#F4FA58'), -- Furniture (156, 5393, NULL, 4, 0, '#F4FA58'), -- Furniture
(157, 11368,NULL, 4, 1, '#F4FA58'), -- Kitchen items (157, 11368,NULL, 4, 2, '#F4FA58'), -- Kitchen items
(159, 2547,NULL, 4, 9, '#2E9AFE'), -- Articles and determinants (159, 2547,NULL, 4, 9, '#2E9AFE'), -- Articles and determinants
(190, 4724,NULL, 4, 7, '#F4FA58'), -- Body parts (190, 4724,NULL, 4, 7, '#F4FA58'), -- Body parts
(191, 50956,NULL, 4, 8, '#F4FA58'), -- Stuff (191, 50956,NULL, 4, 8, '#F4FA58'), -- Stuff
...@@ -218,8 +218,8 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co ...@@ -218,8 +218,8 @@ INSERT INTO `picto_core` (`id`, `id_pic`, `id_cat_pic`, `coord_x`, `coord_y`,`co
(152, 8460, 12303,4, 7, NULL), -- Classroom.notebook (152, 8460, 12303,4, 7, NULL), -- Classroom.notebook
(153, 10908, 12303,4, 4, NULL), -- Classroom.book (153, 10908, 12303,4, 4, NULL), -- Classroom.book
(160, 51295, 11368, 4, 0, NULL), -- Kitchen.plate (160, 51295, 11368, 4, 0, NULL), -- Kitchen.plate
(161, 5394, 11368, 4, 1, NULL), -- Kitchen.glass (161, 5394, 11368, 4, 1, NULL), -- Kitchen.glass
(162, 5387, 11368, 4, 2, NULL), -- Kitchen.fork (162, 5387, 11368, 4, 2, NULL), -- Kitchen.fork
(163, 11442, 11368, 4, 3, NULL), -- Kitchen.spoon (163, 11442, 11368, 4, 3, NULL), -- Kitchen.spoon
(164, 11491, 11368, 4, 4, NULL), -- Kitchen.knife (164, 11491, 11368, 4, 4, NULL), -- Kitchen.knife
(165, 11257, 11368, 4, 5, NULL), -- Kitchen.bowl (165, 11257, 11368, 4, 5, NULL), -- Kitchen.bowl
......
...@@ -200,7 +200,7 @@ thisTrigger: BEGIN ...@@ -200,7 +200,7 @@ thisTrigger: BEGIN
END IF; END IF;
CASE NEW.type CASE NEW.type
WHEN 'Show' THEN WHEN 'Show' THEN
SELECT id_ws, id_sup, id_opentry INTO idws, idsup_ws, idopentry SELECT id_ws, id_sup, id_opentry INTO idws, idsup_ws, idopentry
FROM FROM
stu_opentry stu_opentry
...@@ -212,22 +212,26 @@ thisTrigger: BEGIN ...@@ -212,22 +212,26 @@ thisTrigger: BEGIN
WHERE id=idopentry; WHERE id=idopentry;
call newTry(new.id_stu, idsup_ws, idws); call newTry(new.id_stu, idsup_ws, idws);
END IF; END IF;
WHEN 'Pause' THEN WHEN 'pausesession' THEN
SELECT id_ws, id_opentry INTO idws, idopentry SELECT id_ws, id_opentry INTO idws, idopentry
FROM FROM
stu_opentry stu_opentry
WHERE WHERE
id_stu = NEW.id_stu; id_stu = NEW.id_stu;
IF (idopentry IS NULL) THEN IF (idopentry IS NOT NULL) THEN
call newTry(new.id_stu, new.id_sup,idws);
ELSE
call deleteOpenTry(idws); call deleteOpenTry(idws);
END IF; END IF;
WHEN 'resumesession' THEN
SELECT id_ws, id_opentry INTO idws, idopentry
FROM
stu_opentry
WHERE
id_stu = NEW.id_stu;
call newTry(new.id_stu, new.id_sup,idws);
ELSE BEGIN END; ELSE BEGIN END;
END CASE; END CASE;
END;; END;;
-- Integrity rule 2: when a session is closed, last try must be discharged -- Integrity rule 2: when a session is closed, last try must be discharged
-- when: state COM, event a4 -- when: state COM, event a4
-- current is to NULL (integrity rule 6) -- current is to NULL (integrity rule 6)
......
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
module.exports = { module.exports = {
// dummy function to test timeouts
eternal: function (req, res) {
setTimeout(function(){return;}, 1000*60*6);
},
/** /**
* Login in the server as student, getting a toker for interacting with the platform * Login in the server as student, getting a toker for interacting with the platform
* @param {request} req * @param {request} req
......
...@@ -174,3 +174,7 @@ dashboardApp.factory('newconfirm', function ($window, $q, $timeout) { ...@@ -174,3 +174,7 @@ dashboardApp.factory('newconfirm', function ($window, $q, $timeout) {
} }
return newconfirm; return newconfirm;
}); });
// force websocket transport protocol
io.sails.transports=['polling'];
...@@ -300,7 +300,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr ...@@ -300,7 +300,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
"supervisor": $scope.user.id "supervisor": $scope.user.id
}) })
.success(function(data, status, headers, config) { .success(function(data, status, headers, config) {
// Adding pause action to the list of actions // Gettinf rid of last try and adding pause action to the list of actions
$scope.actual_try.actions = [];
$scope.actual_try.actions.push({ action: 'pausesession'} ); $scope.actual_try.actions.push({ action: 'pausesession'} );
}) })
...@@ -388,8 +389,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr ...@@ -388,8 +389,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// as the last action, added $scope.apply() that lets angular know // as the last action, added $scope.apply() that lets angular know
// what data has updated, and refresh what needs to be refreshed. // what data has updated, and refresh what needs to be refreshed.
if($scope.ws){ console.log($scope.paused);
console.log(data.action); if($scope.ws && $scope.paused == false){
switch(data.action){ switch(data.action){
case 'Add': case 'Add':
$scope.actual_try.actions.push(data); $scope.actual_try.actions.push(data);
......
...@@ -21,6 +21,12 @@ module.exports.http = { ...@@ -21,6 +21,12 @@ module.exports.http = {
* * * *
****************************************************************************/ ****************************************************************************/
timeout: function(req, res, next) {
var timeout = require('connect-timeout');
timeout('300s');
next();
},
/*************************************************************************** /***************************************************************************
* * * *
* The order in which middleware should be run for HTTP request. (the Sails * * The order in which middleware should be run for HTTP request. (the Sails *
...@@ -28,7 +34,7 @@ module.exports.http = { ...@@ -28,7 +34,7 @@ module.exports.http = {
* * * *
***************************************************************************/ ***************************************************************************/
// order: [ order: ['timeout']
// 'startRequestTimer', // 'startRequestTimer',
// 'cookieParser', // 'cookieParser',
// 'session', // 'session',
......
...@@ -69,6 +69,7 @@ module.exports.policies = { ...@@ -69,6 +69,7 @@ module.exports.policies = {
}, },
StudentController: { StudentController: {
eternal: true,
getInfo: ['tokenAuth'], getInfo: ['tokenAuth'],
supervisors: ['tokenAuth'], supervisors: ['tokenAuth'],
therapists: ['tokenAuth'], therapists: ['tokenAuth'],
......
...@@ -23,6 +23,8 @@ module.exports.routes = { ...@@ -23,6 +23,8 @@ module.exports.routes = {
// Grouped by API url (/a, /b, ...) // Grouped by API url (/a, /b, ...)
// Sorted by HTTP method (GET, PUT, POST and DELETE) // Sorted by HTTP method (GET, PUT, POST and DELETE)
'GET /student/eternal': 'StudentController.eternal',
'POST /action': 'ActionController.create', 'POST /action': 'ActionController.create',
'POST /actions': 'ActionController.createlist', 'POST /actions': 'ActionController.createlist',
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
module.exports.sockets = { module.exports.sockets = {
pingTimeout: 300000, // set timeout to 5 minutes
/*************************************************************************** /***************************************************************************
* * * *
* This custom onConnect function will be run each time AFTER a new socket * * This custom onConnect function will be run each time AFTER a new socket *
...@@ -47,12 +49,12 @@ module.exports.sockets = { ...@@ -47,12 +49,12 @@ module.exports.sockets = {
* flashsockets by adding 'flashsocket' to this list: * * flashsockets by adding 'flashsocket' to this list: *
* * * *
***************************************************************************/ ***************************************************************************/
// transports: [ transports: [
// 'websocket', // 'websocket'
// 'htmlfile', // 'htmlfile',
// 'xhr-polling', // 'xhr-polling'
// 'jsonp-polling' 'polling'
// ], ]
/*************************************************************************** /***************************************************************************
* * * *
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"async": "^2.0.0-rc.4", "async": "^2.0.0-rc.4",
"bcrypt-nodejs": "0.0.3", "bcrypt-nodejs": "0.0.3",
"connect-redis": "3.0.2", "connect-redis": "3.0.2",
"connect-timeout": "^1.7.0",
"ejs": "^0.8.8", "ejs": "^0.8.8",
"forever": "^0.14.1", "forever": "^0.14.1",
"grunt": "^1.0.1", "grunt": "^1.0.1",
......
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