Skip to content

Commit aef4fec

Browse files
committed
fix: exporting single study
1 parent 814d0b6 commit aef4fec

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

apps/backend/src/system/export/export.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,14 @@ export class ExportService {
4949
"questionnaire.remark as questionnaire_remark",
5050
"participant.id as participant_id",
5151
"participant.birthday",
52-
"study.id as study_id",
53-
"study.title as study_title",
5452
])
53+
.distinct()
5554
.join("carer", "carer")
5655
.join("entryLanguages", "entryLanguages")
5756
.join("entryLanguages.language", "language")
5857
.join("entry.questionnaire", "questionnaire")
59-
.join("questionnaire.study", "study")
6058
.join("questionnaire.participant", "participant")
61-
.where({ questionnaire: { study: studyId } })
59+
.where({ questionnaire: { participant: { studies: { $some: { id: studyId } } } } })
6260
.getFormattedQuery();
6361

6462
const copyCommand = `COPY (${query}) TO STDOUT WITH CSV HEADER DELIMITER ',';`;

0 commit comments

Comments
 (0)