mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:47:07 +00:00
Add functions to accept/unaccept QCs.
These are only able to deal with shot QCs. At this point, sequence-wide QCs cannot be marked as accepted.
This commit is contained in:
23
lib/www/server/lib/db/qc/results/accept.js
Normal file
23
lib/www/server/lib/db/qc/results/accept.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { setSurvey } = require('../../connection');
|
||||
|
||||
async function accept (projectId, payload) {
|
||||
const client = await setSurvey(projectId);
|
||||
|
||||
const text = `
|
||||
UPDATE event_log_full
|
||||
SET
|
||||
labels = array_append(labels, 'QCAccepted')
|
||||
WHERE
|
||||
validity @> current_timestamp
|
||||
AND id = ANY($1)
|
||||
AND NOT ('QCAccepted' = ANY(labels));
|
||||
`;
|
||||
|
||||
const values = [ payload ];
|
||||
|
||||
await client.query(text, values);
|
||||
client.release();
|
||||
return;
|
||||
}
|
||||
|
||||
module.exports = accept;
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
module.exports = {
|
||||
get: require('./get'),
|
||||
delete: require('./delete')
|
||||
delete: require('./delete'),
|
||||
accept: require('./accept'),
|
||||
unaccept: require('./unaccept')
|
||||
};
|
||||
|
||||
22
lib/www/server/lib/db/qc/results/unaccept.js
Normal file
22
lib/www/server/lib/db/qc/results/unaccept.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const { setSurvey, transaction } = require('../../connection');
|
||||
|
||||
async function unaccept (projectId, payload) {
|
||||
const client = await setSurvey(projectId);
|
||||
|
||||
const text = `
|
||||
UPDATE event_log_full
|
||||
SET
|
||||
labels = array_remove(labels, 'QCAccepted')
|
||||
WHERE
|
||||
validity @> current_timestamp
|
||||
AND id = ANY($1);
|
||||
`;
|
||||
|
||||
const values = [ payload ];
|
||||
|
||||
await client.query(text, values);
|
||||
client.release();
|
||||
return;
|
||||
}
|
||||
|
||||
module.exports = unaccept;
|
||||
Reference in New Issue
Block a user