Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-rings-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@quassel/backend": patch
---

Fix report csv if the amount of langugage varys between participants
8 changes: 7 additions & 1 deletion apps/backend/src/system/reports/reports.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
],
});

const columnKeys = new Set(["participant"]);

Check warning on line 27 in apps/backend/src/system/reports/reports.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/system/reports/reports.service.ts#L27

Added line #L27 was not covered by tests

const evaluatedExposurePerParticipant = participants.map((participant) => {
const exposure = this.getParticipantExposure(participant);
const sortedExposureEntries = Array.from(exposure).sort(([_a, exposureA], [_b, exposureB]) => exposureB - exposureA);
Expand All @@ -34,14 +36,18 @@
acc[`L${index + 1}`] = duration / exposureSum;
acc[`L${index + 1}_id`] = language.id;
acc[`L${index + 1}_name`] = language.name;
columnKeys

Check warning on line 39 in apps/backend/src/system/reports/reports.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/system/reports/reports.service.ts#L39

Added line #L39 was not covered by tests
.add(`L${index + 1}`)
.add(`L${index + 1}_id`)
.add(`L${index + 1}_name`);

return acc;
},
{ participant: participant.id }
);
});

return stringify(evaluatedExposurePerParticipant, { header: true });
return stringify(evaluatedExposurePerParticipant, { header: true, columns: Array.from(columnKeys) });

Check warning on line 50 in apps/backend/src/system/reports/reports.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/backend/src/system/reports/reports.service.ts#L50

Added line #L50 was not covered by tests
}

getParticipantExposure(participant: Participant) {
Expand Down
Loading