-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🗃️ Créer le questionnaire litteratie_2024 et la première question de …
…cafe de la place
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
db/migrate/20241108040153_cree_questionnaire_litteratie.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class CreeQuestionnaireLitteratie < ActiveRecord::Migration[7.0] | ||
class ::Questionnaire < ApplicationRecord; end | ||
class ::QuestionnaireQuestion < ApplicationRecord; end | ||
class ::Question < ApplicationRecord; end | ||
class ::Transcription < ApplicationRecord; end | ||
class ::Choix < ApplicationRecord;end | ||
|
||
def change | ||
litteratie = Questionnaire.find_or_create_by(nom_technique: 'litteratie_2024') do |q| | ||
q.libelle = "Littératie 2024" | ||
end | ||
question = Question.find_or_create_by(nom_technique: 'lodi_1') do |q| | ||
q.libelle = "LOdi1" | ||
q.type = 'QuestionQcm' | ||
end | ||
Transcription.find_or_create_by(categorie: :intitule, question_id: question.id) do |t| | ||
t.ecrit = "De quoi s’agit-il ?" | ||
end | ||
Transcription.find_or_create_by(categorie: :modalite_reponse, question_id: question.id) do |t| | ||
t.ecrit = 'Choisissez une des réponses ci-dessous. Pour écouter ou réécouter les questions ou les réponses, cliquez sur le bouton « Lecture » ( <svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" fill="#6e84fe" r="10"/><path d="M14 8.701c1 .577 1 2.02 0 2.598l-5.813 3.356a1.5 1.5 0 0 1-2.25-1.3v-6.71a1.5 1.5 0 0 1 2.25-1.3z" fill="#fff"/></svg> ) à gauche de la phrase que vous souhaitez entendre. Pour confirmer votre réponse, cliquez sur « Valider ».' | ||
end | ||
choix = [ | ||
{ nom_technique: 'LOdi/couverture', intitule: 'La couverture', type_choix: 'mauvais' }, | ||
{ nom_technique: 'LOdi/programme_tele', intitule: 'Un programme télé', type_choix: 'bon' }, | ||
{ nom_technique: 'LOdi/mots_croises', intitule: 'Une page de mots croisés', type_choix: 'mauvais' } | ||
] | ||
choix.each do |data| | ||
Choix.find_or_create_by(question_id: question.id) do |c| | ||
c.nom_technique = data[:nom_technique] | ||
c.intitule = data[:intitule] | ||
c.type_choix = data[:type_choix] | ||
end | ||
end | ||
QuestionnaireQuestion.find_or_create_by(questionnaire_id: litteratie.id, question_id: question.id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.