2018-09-13 16:13:54 +02:00
|
|
|
module NewUser
|
|
|
|
class DemarchesController < UserController
|
|
|
|
def index
|
|
|
|
@previous_demarches_still_active = current_user
|
|
|
|
.dossiers
|
|
|
|
.includes(:procedure)
|
|
|
|
.map(&:procedure)
|
|
|
|
.uniq
|
|
|
|
.select { |p| p.publiee? }
|
2018-09-11 00:16:30 +02:00
|
|
|
|
|
|
|
@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)
|
2018-09-13 16:13:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|