2015-05-19 14:25:35 +02:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
2015-07-03 13:27:05 +02:00
|
|
|
var Log = require('../../lib/NodeLog.js');
|
2015-05-19 14:25:35 +02:00
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
2015-08-04 18:59:24 +02:00
|
|
|
"INSERT INTO keyboardevent(exp_id, camera, time, keycode, keypressed)" +
|
|
|
|
"VALUES($1, ROW(ROW($2,$3,$4),ROW($5,$6,$7)), to_timestamp($8), $9, $10);" ,
|
2015-05-19 14:25:35 +02:00
|
|
|
[
|
2015-06-04 16:52:58 +02:00
|
|
|
req.session.exp_id,
|
|
|
|
req.body.camera.position.x,
|
|
|
|
req.body.camera.position.y,
|
|
|
|
req.body.camera.position.z,
|
2015-05-19 14:25:35 +02:00
|
|
|
|
2015-06-04 16:52:58 +02:00
|
|
|
req.body.camera.target.x,
|
|
|
|
req.body.camera.target.y,
|
|
|
|
req.body.camera.target.z,
|
2015-05-20 10:23:19 +02:00
|
|
|
|
2015-08-04 18:59:24 +02:00
|
|
|
req.body.time,
|
|
|
|
|
|
|
|
req.body.keycode,
|
|
|
|
req.body.keypressed
|
2015-05-19 14:25:35 +02:00
|
|
|
],
|
|
|
|
function(err, result) {
|
2015-07-01 11:31:44 +02:00
|
|
|
if (err !== null)
|
2015-07-09 15:04:55 +02:00
|
|
|
Log.dberror(err + ' in keyboard-event');
|
2015-05-19 14:25:35 +02:00
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
2015-07-01 10:14:15 +02:00
|
|
|
res.send("");
|
|
|
|
};
|