Add links to the most popular demarches
This commit is contained in:
parent
523fdb5d45
commit
aba0c1dcd6
2 changed files with 16 additions and 0 deletions
|
@ -7,6 +7,15 @@ module NewUser
|
|||
.map(&:procedure)
|
||||
.uniq
|
||||
.select { |p| p.publiee? }
|
||||
|
||||
@popular_demarches = Procedure
|
||||
.select("procedures.*, COUNT(*) AS procedures_count")
|
||||
.joins(:dossiers)
|
||||
.publiees
|
||||
.where(dossiers: { created_at: 7.days.ago..Time.now })
|
||||
.group("procedures.id")
|
||||
.order("procedures_count DESC")
|
||||
.limit(5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,5 +10,12 @@
|
|||
%li
|
||||
= link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link")
|
||||
|
||||
- if @popular_demarches.present?
|
||||
%h2.list-header LES PLUS POPULAIRES
|
||||
%ul.demarche-links
|
||||
- @popular_demarches.each do |demarche|
|
||||
%li
|
||||
= link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link")
|
||||
|
||||
%h2.list-header TOUTES LES DÉMARCHES
|
||||
= link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button")
|
||||
|
|
Loading…
Reference in a new issue