From b887f315220b0f7cfce55931af35a719da0aaa57 Mon Sep 17 00:00:00 2001 From: Ben De Meurichy Date: Sun, 19 May 2024 20:31:38 +0200 Subject: [PATCH] regex op de output van een automatische test om enkel de geteste bestanden te zien --- .../pages/submissionPage/SubmissionPage.tsx | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/frontend/frontend/src/pages/submissionPage/SubmissionPage.tsx b/frontend/frontend/src/pages/submissionPage/SubmissionPage.tsx index dc506f24..fe1c0297 100644 --- a/frontend/frontend/src/pages/submissionPage/SubmissionPage.tsx +++ b/frontend/frontend/src/pages/submissionPage/SubmissionPage.tsx @@ -129,17 +129,28 @@ export function SubmissionPage() { ) setRestrictions(restrictions.data) - const submissionResponse = await instance.get(`indieningen/${submissionId}/`) + const submissionResponse = await instance.get( + `indieningen/${submissionId}/` + ) //Get the submission file const newSubmission: Submission = submissionResponse.data - newSubmission.filename = submissionResponse.data.bestand.replace( - /^.*[\\/]/, - '' - ) + if (newSubmission.result !== 'No tests: OK') { + const regex = /Testing (.*):/g + const matches = newSubmission.result.match(regex) + if (matches !== null) { + matches.map((match) => { + match.replace(':', '\n') + return match + }) + } + } + newSubmission.filename = + submissionResponse.data.bestand.replace(/^.*[\\/]/, '') newSubmission.bestand = await instance .get(`/indieningen/${submissionId}/indiening_bestand`, { responseType: 'blob', - }).then((res) => { + }) + .then((res) => { let filename = 'indiening.zip' if (newSubmission.filename) { filename = newSubmission.filename