From 301fb7676240cecf8bebb449486d6824f143b0e0 Mon Sep 17 00:00:00 2001 From: Marie Leuliette Date: Thu, 14 Nov 2024 22:15:39 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=B1=20Modifie=20la=20t=C3=A2che=20rake?= =?UTF-8?q?=20pour=20pouvoir=20attacher=20les=20assets=20de=20la=20questio?= =?UTF-8?q?n=20glisser=20d=C3=A9poser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/questions.rake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tasks/questions.rake b/lib/tasks/questions.rake index cec8fc974..860a768a4 100644 --- a/lib/tasks/questions.rake +++ b/lib/tasks/questions.rake @@ -54,6 +54,9 @@ constantes = { sous_consigne_HPfb_1: 'terrasse_cafe', sous_consigne_HPfb_2: 'telephone_email' }, + NOM_TECHNIQUES_GLISSER_DEPOSER: { + hpar_1: 'journal_vide' + }, DOSSIER_ID: 'DOSSIER_ID', TYPE_QUESTION: 'TYPE_QUESTION' } @@ -82,6 +85,8 @@ namespace :questions do attache_assets(NOM_TECHNIQUES_QCM) when 'SOUS_CONSIGNE' attache_assets(NOM_TECHNIQUES_CONSIGNES) + when 'GLISSER_DEPOSER' + attache_assets(NOM_TECHNIQUES_GLISSER_DEPOSER) end end end @@ -102,6 +107,7 @@ def attache_assets(nom_techniques) recupere_fichier(question, "#{nom_illustration}.png") recupere_fichier(question, "#{question.nom_technique}.mp3", question.transcription_intitule) attach_audio_choix(question) if nom_techniques == NOM_TECHNIQUES_QCM + attach_images_reponses(question) if nom_techniques == NOM_TECHNIQUES_GLISSER_DEPOSER end end @@ -123,6 +129,12 @@ def attach_audio_choix(question) end end +def attach_images_reponses(question) + question.reponses.each do |choix| + recupere_fichier(question, "#{choix.nom_technique}.png", choix) + end +end + def attach_file_to(instance, file_content, fichier_path, nom_technique) instance.send(attachment_type(fichier_path)).attach( io: StringIO.new(file_content),