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
|
2018-10-01 14:20:14 +02:00
|
|
|
.select(&:publiee?)
|
2018-09-11 00:16:30 +02:00
|
|
|
|
|
|
|
@popular_demarches = Procedure
|
2018-09-18 10:39:47 +02:00
|
|
|
.includes(:service)
|
2018-09-11 00:16:30 +02:00
|
|
|
.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
|