2015-05-21 14:35:40 +01:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
2015-07-03 12:27:05 +01:00
|
|
|
var Log = require('../../lib/NodeLog.js');
|
2015-05-21 14:35:40 +01:00
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
2015-06-04 15:52:58 +01:00
|
|
|
"INSERT INTO hovered(exp_id, time, start, arrow_id)" +
|
2015-05-21 14:35:40 +01:00
|
|
|
"VALUES($1, to_timestamp($2), $3, $4);" ,
|
|
|
|
[
|
2015-06-04 15:52:58 +01:00
|
|
|
req.session.exp_id,
|
2015-05-21 14:35:40 +01:00
|
|
|
req.body.time,
|
|
|
|
req.body.start ? true : false,
|
|
|
|
req.body.arrow_id
|
|
|
|
],
|
|
|
|
function(err, result) {
|
2015-07-01 10:31:44 +01:00
|
|
|
if (err !== null)
|
2015-07-09 14:04:55 +01:00
|
|
|
Log.dberror(err + ' in hovered');
|
2015-05-21 14:35:40 +01:00
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
2015-06-04 15:52:58 +01:00
|
|
|
res.send("");
|
2015-07-01 09:14:15 +01:00
|
|
|
};
|