mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:27:09 +00:00
Add missing option to sequence.list DB method.
If present and truthy, it will cause the output to contain two extra fields: missing_raw and missing_final, each consisting of a JSON array containing missing raw and final shots for the corresponding sequence. In the event that the option was passed but there are no missing shots, the two aforementioned fields will still be present and consist of empty arrays. Note that this makes the query significantly slower.
This commit is contained in:
@@ -27,6 +27,12 @@ async function list (projectId, opts = {}) {
|
||||
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,
|
||||
COALESCE((SELECT jsonb_agg(msfp) FROM missing_sequence_final_points msfp WHERE msfp.sequence = ss.sequence), '[]'::jsonb) missing_final`
|
||||
: "";
|
||||
|
||||
const text = (opts.files
|
||||
? `
|
||||
WITH
|
||||
@@ -45,14 +51,14 @@ async function list (projectId, opts = {}) {
|
||||
GROUP BY sequence
|
||||
)
|
||||
SELECT
|
||||
ss.*,
|
||||
ss.*${missing_shots},
|
||||
(SELECT files FROM rf WHERE rf.sequence = ss.sequence) raw_files,
|
||||
(SELECT files FROM ff WHERE ff.sequence = ss.sequence) final_files
|
||||
FROM sequences_summary ss
|
||||
`
|
||||
: `
|
||||
SELECT *
|
||||
FROM sequences_summary
|
||||
SELECT ss.*${missing_shots}
|
||||
FROM sequences_summary ss
|
||||
`)
|
||||
+ `
|
||||
WHERE
|
||||
|
||||
Reference in New Issue
Block a user