2015-05-20 16:28:53 +02:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
2015-06-04 16:52:58 +02:00
|
|
|
"INSERT INTO previousnextclicked(exp_id, previousnext, time, camera)" +
|
2015-05-20 16:28:53 +02:00
|
|
|
"VALUES($1, $2, to_timestamp($3), ROW(ROW($4,$5,$6), ROW($7,$8,$9)));" ,
|
|
|
|
[
|
2015-06-04 16:52:58 +02:00
|
|
|
req.session.exp_id,
|
2015-05-20 16:28:53 +02:00
|
|
|
req.body.previous ? 'p' : 'n',
|
|
|
|
req.body.time,
|
2015-06-04 16:52:58 +02:00
|
|
|
req.body.camera.position.x,
|
|
|
|
req.body.camera.position.y,
|
|
|
|
req.body.camera.position.z,
|
|
|
|
req.body.camera.target.x,
|
|
|
|
req.body.camera.target.y,
|
|
|
|
req.body.camera.target.z
|
2015-05-20 16:28:53 +02:00
|
|
|
],
|
|
|
|
function(err, result) {
|
2015-07-01 11:31:44 +02:00
|
|
|
if (err !== null)
|
|
|
|
console.log("[DBERROR] " + err);
|
2015-05-20 16:28:53 +02:00
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
2015-06-04 16:52:58 +02:00
|
|
|
res.send("");
|
2015-05-20 16:28:53 +02:00
|
|
|
|
2015-07-01 10:14:15 +02:00
|
|
|
};
|