From fa0c257040f18ee55b04c22e482bf0ce92ed6ef2 Mon Sep 17 00:00:00 2001 From: Carlos-Mesquita Date: Wed, 11 Dec 2024 16:09:59 +0000 Subject: [PATCH] Fixed a bug from the previous commit, ENCOA-274 --- .../ExamEditor/SettingsEditor/writing/components.tsx | 2 +- .../ExamEditor/SettingsEditor/writing/index.tsx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/ExamEditor/SettingsEditor/writing/components.tsx b/src/components/ExamEditor/SettingsEditor/writing/components.tsx index acd0e18c..9bacbf41 100644 --- a/src/components/ExamEditor/SettingsEditor/writing/components.tsx +++ b/src/components/ExamEditor/SettingsEditor/writing/components.tsx @@ -126,7 +126,7 @@ const WritingComponents: React.FC = ({ localSettings, updateLocalAndSched } { - type !== "academic" || (type === "academic" && academic_url !== undefined) && { return; } try { - let firebase_url = undefined; + let firebase_url: string | undefined = undefined; if (type === "academic" && academic_url) { const formData = new FormData(); - const sectionMap = new Map(); const fetchedBlob = await fetch(academic_url); const blob = await fetchedBlob.blob(); formData.append('file', blob); - sectionMap.set(1, academic_url); const response = await axios.post('/api/storage', formData, { params: { @@ -110,13 +108,13 @@ const WritingSettings: React.FC = () => { 'Content-Type': 'multipart/form-data' } }); - firebase_url = response.data.urls[1]; + firebase_url = response.data.urls[0]; } const exam: WritingExam = { - exercises: sections.map((s) => { + exercises: sections.map((s, index) => { const exercise = s.state as WritingExercise; - if (exercise.sectionId == 1 && firebase_url) { + if (index == 0 && firebase_url) { exercise["attachment"] = { url: firebase_url, description: "Visual Information"