Skip to content

Commit

Permalink
Change pattern_matching_rois sql script
Browse files Browse the repository at this point in the history
  • Loading branch information
Tooseriuz committed Aug 7, 2024
1 parent 8c35f94 commit b7fa5ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions apps/cli/src/backup/projects/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ export const generateCsvs = async (
}

if (item === 'pattern_matching_rois' && !minimum) {
const allRecords = fetchAllRecordsUsingSubquery<{ pattern_matching_id: number }>(
const allRecords = fetchAllRecordsUsingSubquery<{ project_id: number }>(
'pattern_matchings',
item,
{ projectId },
(t) => ({ patternMatchingId: t.pattern_matching_id }),
(t) => ({ projectId: t.project_id }),
sequelize,
storage,
legacyStorage,
Expand Down
31 changes: 15 additions & 16 deletions apps/cli/src/backup/projects/export/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,25 @@ export const PATTERN_MATCHINGS = `
`

export const PATTERN_MATCHING_ROIS = `
select
pattern_matching_roi_id,
pmr.pattern_matching_id,
recording_id,
pmr.species_id,
pmr.songtype_id,
x1,
y1,
x2,
y2,
score,
validated
from pattern_matching_rois pmr
join pattern_matchings pm on pmr.pattern_matching_id = pm.pattern_matching_id
join jobs j on pm.job_id = j.job_id
where pm.pattern_matching_id = $patternMatchingId and pm.deleted = 0 and j.state = 'completed'
select
pmr.pattern_matching_id,
pmr.recording_id,
pmr.species_id,
pmr.songtype_id,
x1,
x2,
y1,
y2,
score,
validated
from pattern_matching_rois pmr
join pattern_matchings pm on pmr.pattern_matching_id = pm.pattern_matching_id
where pm.project_id = $projectId and validated is not null
limit $limit
offset $offset
`


export const SOUNDSCAPES = `
select
soundscape_id,
Expand Down

0 comments on commit b7fa5ff

Please sign in to comment.