mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:57:08 +00:00
Make it possible to list one specific sequence
This commit is contained in:
@@ -14,8 +14,12 @@ async function list (projectId, opts = {}) {
|
||||
const filter = opts.filter;
|
||||
const noFilter = !("filter" in opts) || opts.filter === null || !String(opts.filter).trim().length;
|
||||
|
||||
const sequenceText = opts.sequence
|
||||
? "sequence = $4"
|
||||
: "$4 = $4";
|
||||
|
||||
const filterText = noFilter
|
||||
? "TRUE"
|
||||
? "$3 = $3"
|
||||
: `
|
||||
$3 = sequence::text
|
||||
OR line::text ~ $3
|
||||
@@ -26,7 +30,7 @@ async function list (projectId, opts = {}) {
|
||||
OR (($3 ILIKE 'process%' OR $3 ILIKE 'final%') AND duration_final IS NOT NULL)
|
||||
OR ($3 ILIKE 'raw' AND duration_final IS NULL)
|
||||
`;
|
||||
|
||||
|
||||
const missing_shots = opts.missing
|
||||
? `,
|
||||
COALESCE((SELECT jsonb_agg(msrp) FROM missing_sequence_raw_points msrp WHERE msrp.sequence = ss.sequence), '[]'::jsonb) missing_raw,
|
||||
@@ -62,14 +66,14 @@ async function list (projectId, opts = {}) {
|
||||
`)
|
||||
+ `
|
||||
WHERE
|
||||
${sequenceText} AND
|
||||
${filterText}
|
||||
ORDER BY ${sortKey} ${sortDir}
|
||||
OFFSET $1
|
||||
LIMIT $2;
|
||||
`;
|
||||
|
||||
const values = [offset, limit];
|
||||
if (!noFilter) values.push(filter);
|
||||
const values = [offset, limit, filter||0, opts.sequence||0];
|
||||
const res = await client.query(text, values);
|
||||
client.release();
|
||||
return res.rows;
|
||||
|
||||
Reference in New Issue
Block a user