Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eva 229 le superadmin peut parametrer une question saisie pour litteratie #1748

Conversation

marouria
Copy link
Contributor

No description provided.

@marouria marouria force-pushed the EVA-229-le-superadmin-peut-parametrer-une-question-saisie-pour-litteratie branch from f3ef90f to 99814b5 Compare November 19, 2024 08:23
@marouria marouria marked this pull request as ready for review November 19, 2024 08:23
@marouria marouria force-pushed the EVA-229-le-superadmin-peut-parametrer-une-question-saisie-pour-litteratie branch 3 times, most recently from ea23a31 to 61d953e Compare November 19, 2024 09:14
def ajoute_saisies(reponse, index)
columns = %w[intitule nom_technique type_choix]
columns.each_with_index do |col, i|
@sheet[0, 11 + (index * 3) + i] = "reponse_#{index + 1}_#{col}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ca représente quoi (index * 3) + i ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est l'algo qui permet de calculer le numéro de la colonne. J'ai repris ce qui a été fait pour les autres types de questions. Ici on spécifie qu'on a besoin de 3 colonnes pour chaque réponse.
J'ai donc remplacé par columns.size , également dans ajoute_reponseset ajoute_choix

columns = %w[intitule nom_technique type_choix]
columns.each_with_index do |col, i|
@sheet[0, 11 + (index * 3) + i] = "reponse_#{index + 1}_#{col}"
@sheet[@ligne, 11 + (index * 3) + i] = reponse.send(col)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est pas forcément une bonne pratique la méta-programmation (send), cela rend le code complexe et difficile à maintenir 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai réutilisé la fonctionnalité qui a été mise en place dans ajoute_choix et ajoute_reponses`

@marouria marouria force-pushed the EVA-229-le-superadmin-peut-parametrer-une-question-saisie-pour-litteratie branch from 61d953e to 0a9ca30 Compare November 19, 2024 13:08
@cprodhomme cprodhomme merged commit d9b9eef into develop Nov 19, 2024
5 checks passed
@cprodhomme cprodhomme deleted the EVA-229-le-superadmin-peut-parametrer-une-question-saisie-pour-litteratie branch November 19, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants