2015-07-09 15:38:56 +02:00
|
|
|
var pg = require('pg');
|
|
|
|
var secret = require('../../private');
|
|
|
|
var Log = require('../../lib/NodeLog.js');
|
|
|
|
|
|
|
|
module.exports.index = function(req, res) {
|
|
|
|
|
2015-07-22 10:10:11 +02:00
|
|
|
req.session.locked = req.body.locked;
|
|
|
|
req.session.save();
|
|
|
|
|
2015-07-09 15:38:56 +02:00
|
|
|
pg.connect(secret.url, function(err, client, release) {
|
|
|
|
client.query(
|
|
|
|
"INSERT INTO switchedlockoption(exp_id, locked, time) VALUES($1,$2,to_timestamp($3));",
|
2015-08-28 21:34:29 +02:00
|
|
|
[req.session.expId, req.body.locked, req.body.time],
|
2015-07-09 15:38:56 +02:00
|
|
|
function(err, result) {
|
|
|
|
if (err !== null)
|
2015-07-22 10:10:11 +02:00
|
|
|
Log.dberror(err + ' in swithched lock option');
|
2015-07-09 15:38:56 +02:00
|
|
|
release();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
res.send("");
|
|
|
|
};
|