Skip to content

Conversation

@janoliver20
Copy link

Also extracted test settings into a dedicated vitest.config and changed env variable to let user change the backend url more easy

…s of study data

Also extracted test settings into a dedicated vitest.config and changed env variable to let user change the backend url more easy
@janoliver20 janoliver20 requested a review from iaigner November 26, 2025 14:15
@janoliver20 janoliver20 self-assigned this Nov 26, 2025
@github-actions
Copy link

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit f4c1101. ± Comparison against base commit e66951b.

Comment on lines +167 to +195
await importExportApi
.exportStudyData(
studyId,
rs.data.token,
studyGroupId,
participantId,
observationId,
from,
to,
{ responseType: 'blob' },
)
.then((response) => {
const blob = response.data as unknown as Blob;

}).catch((e: AxiosError) => {
handleIndividualError(
e,
'cannot export data despite of existing download token',
);
} );
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `study_data_${studyId}.json`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
})
.catch((e: AxiosError) => {
handleIndividualError(
e,
'cannot export data despite of existing download token',
);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soviel isch sehe ist das der Fix für den Bug. Alle anderen Änderungen haben nichts mit dem #6 zu tun, oder?

Es wäre echt besser, wenn Du einfach 2 Merge Requests aufmachst.

  • Den ersten für das Refactoring - auch wenn da dann kein Issue mit dabei ist.
  • Den zweiten mit nur den Fix für den Bug im Issue!

So schaue ich mir einen MR über 9 Files mit hunderten Zeilen an Änderungen an, aber der eigentliche fix sind nur 20 Zeilen.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja es hat sonst leider bei mir immer Probleme gemacht, weswegen ich leider alles andere auch ändern musste.

const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `study_data_${studyId}.json`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wäre es nicht besser, wenn das Webservice schon einen passenden Content-Disposition Header setzten würde. z.B.

Content-Disposition: attachment; filename="study_data_study-{id}.json"

Würde in den Namen auch gleich noch andere Filter wie StudyGroup oder Participant sowie die Time-Range mit reincodieren (am Backend). Dieser Header sollte dann den Browser dazu veranlassen das Ergebnis direkt in einem File zu speichern

Copy link
Member

@westei westei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Als Bugfix OK, aber @janoliver20 bitte erstelle einen Issue, dass wir das auf den Content-Disposition im Backend und in der OpenAPI Spec umstellen. Den Issue können wir dann ja in einem Sprint einplanen, wenn wir am StudyManager Backend was machen

@janoliver20 janoliver20 merged commit 1db39e7 into develop Nov 27, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants