Skip to content

Commit

Permalink
🗃️ Créer le questionnaire litteratie_2024 et la première question de …
Browse files Browse the repository at this point in the history
…cafe de la place
  • Loading branch information
marouria committed Nov 8, 2024
1 parent ae05a33 commit 52ba1ff
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions db/migrate/20241108040153_cree_questionnaire_litteratie.rb
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
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_09_26_055940) do
ActiveRecord::Schema[7.0].define(version: 2024_11_08_040153) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down
Binary file modified docs/erd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 52ba1ff

Please sign in to comment.