Merge pull request #8936 from demarches-simplifiees/add-yes-no-column-for-instructeurs
[instructeur] ajout du nb de réponses oui/non aux avis dans le tableau d'une procedure
This commit is contained in:
commit
e393132fd8
7 changed files with 22 additions and 2 deletions
|
@ -60,7 +60,8 @@ class ProcedurePresentation < ApplicationRecord
|
|||
fields.push(
|
||||
field_hash('user', 'email', type: :text),
|
||||
field_hash('followers_instructeurs', 'email', type: :text),
|
||||
field_hash('groupe_instructeur', 'id', type: :enum)
|
||||
field_hash('groupe_instructeur', 'id', type: :enum),
|
||||
field_hash('avis', 'id', type: :text)
|
||||
)
|
||||
|
||||
if procedure.for_individual
|
||||
|
@ -246,7 +247,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
Dossier.human_attribute_name("state.#{filter['value']}")
|
||||
elsif filter['table'] == 'groupe_instructeur' && filter['column'] == 'id'
|
||||
instructeur.groupe_instructeurs
|
||||
.find { _1.id == filter['value'].to_i }&.label || "Groupe Instucteur #{filter['value']}"
|
||||
.find { _1.id == filter['value'].to_i }&.label || filter['value']
|
||||
else
|
||||
filter['value']
|
||||
end
|
||||
|
|
|
@ -92,6 +92,14 @@ class DossierProjectionService
|
|||
.group_by { |dossier_id, _| dossier_id }
|
||||
.to_h { |dossier_id, dossier_id_emails| [dossier_id, dossier_id_emails.sort.map { |_, email| email }&.join(', ')] }
|
||||
# rubocop:enable Style/HashTransformValues
|
||||
when 'avis'
|
||||
# rubocop:disable Style/HashTransformValues
|
||||
fields[0][:id_value_h] = Avis
|
||||
.where(dossier_id: dossiers_ids)
|
||||
.pluck('dossier_id', 'question_answer')
|
||||
.group_by { |dossier_id, _| dossier_id }
|
||||
.to_h { |dossier_id, question_answer| [dossier_id, question_answer.map { |_, answer| answer }&.compact&.tally&.map { |k, v| I18n.t("helpers.label.question_answer_with_count.#{k}", count: v) }&.join(' / ')] }
|
||||
# rubocop:enable Style/HashTransformValues
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ en:
|
|||
question_answer:
|
||||
true: 'yes'
|
||||
false: 'no'
|
||||
question_answer_with_count:
|
||||
true: "yes : %{count}"
|
||||
false: "no : %{count}"
|
||||
confirmation:
|
||||
revoke: "Would you like to revoke the opinion request to %{email} ?"
|
||||
remind: "Would you like to remind %{email} ?"
|
||||
|
|
|
@ -21,6 +21,9 @@ fr:
|
|||
question_answer:
|
||||
true: oui
|
||||
false: non
|
||||
question_answer_with_count:
|
||||
true: "oui : %{count}"
|
||||
false: "non : %{count}"
|
||||
confirmation:
|
||||
revoke: "Souhaitez-vous révoquer la demande d’avis à %{email} ?"
|
||||
remind: "Souhaitez-vous relancer %{email} ?"
|
||||
|
|
|
@ -28,6 +28,8 @@ en:
|
|||
prenom: First name
|
||||
nom: Last name
|
||||
gender: Title
|
||||
avis:
|
||||
id: Opinion
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
|
|
|
@ -28,6 +28,8 @@ fr:
|
|||
prenom: Prénom
|
||||
nom: Nom
|
||||
gender: Civilité
|
||||
avis:
|
||||
id: Avis
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
|
|
|
@ -73,6 +73,7 @@ describe ProcedurePresentation do
|
|||
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Email instructeur', "table" => 'followers_instructeurs', "column" => 'email', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Groupe instructeur', "table" => 'groupe_instructeur', "column" => 'id', 'classname' => '', 'virtual' => false, 'type' => :enum, "scope" => '' },
|
||||
{ "label" => 'Avis', "table" => 'avis', "column" => 'id', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
|
|
Loading…
Reference in a new issue