Skip to content

Commit d825982

Browse files
authored
Merge pull request #451 from openscript-ch/446-error-during-export
Error during export
2 parents 814d0b6 + 75f452a commit d825982

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.changeset/rich-dryers-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@quassel/backend": patch
3+
---
4+
5+
Fix exporting by study

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)