From b626c8a8184769b4819b7ba528bf6d26b4746b6a Mon Sep 17 00:00:00 2001 From: Gaspard Jankowiak Date: Fri, 5 Jun 2026 08:41:06 +0200 Subject: [PATCH] fix naming to introduce applicantDetails --- content.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/content.js b/content.js index 0da02b8..6f4bb2f 100644 --- a/content.js +++ b/content.js @@ -20,10 +20,10 @@ async function getXSRFToken() { } async function getApplicant(applicant, token) { - return getApplicantWithProgress(applicant, token) + return getApplicantDetailsWithProgress(applicant, token) } -async function getApplicantWithProgress(applicant, token, onProgress = () => { }) { +async function getApplicantDetailsWithProgress(applicant, token, onProgress = () => { }) { return fetch(`https://personal.uni-graz.at/api/erec/job-applications/${applicant.id}`, { credentials: "same-origin", @@ -279,12 +279,12 @@ function rip(event) { progressDialog.initializeApplicant(applicant) }) - const applicantResults = await Promise.allSettled(applicants.map(async (applicant) => { + const applicantDetailsResults = await Promise.allSettled(applicants.map(async (applicant) => { try { - const applicantData = await getApplicantWithProgress(applicant, token, ({ downloaded, total, bytes }) => { + const applicantDetails = await getApplicantDetailsWithProgress(applicant, token, ({ downloaded, total, bytes }) => { progressDialog.updateApplicant(applicant, downloaded, total, bytes) }) - return applicantData + return applicantDetails } catch (error) { progressDialog.markApplicantFailed(applicant) throw error @@ -294,23 +294,20 @@ function rip(event) { progressDialog.setStatus("Creating zip archive...") const zip = new JSZip() - applicantResults.forEach((result) => { + applicantDetailsResults.forEach((result) => { if (result.status !== "fulfilled") { throw result.reason } - const applicant = result.value - const dirName = `${applicant.last_name}_${applicant.first_name}` - // const dirName = `${sanitizeZipPathSegment(applicant.last_name)}_${sanitizeZipPathSegment(applicant.first_name)}` + const applicantDetails = result.value + // const dirName = `${applicantDetails.last_name}_${applicantDetails.first_name}` + const dirName = `${sanitizeZipPathSegment(applicantDetails.last_name)}_${sanitizeZipPathSegment(applicantDetails.first_name)}` const applicantDir = zip.folder(dirName) - const files = applicant.application_files ?? [] + const files = applicantDetails.application_files ?? [] files.forEach((afile) => { const ext = afile.file_name.split(".").slice(-1) const filename = `${afile.field_name}.${ext}` - // const filename = sanitizeZipPathSegment(afile.file_name) - console.log(filename) - console.log(afile.blob) applicantDir.file(filename, afile.blob) }) })