demarches-normaliennes/app/controllers/users/demarches_controller.rb

23 lines
590 B
Ruby
Raw Permalink Normal View History

2019-03-25 10:53:45 +01:00
module Users
class DemarchesController < UserController
def index
@previous_demarches_still_active = current_user
.dossiers
.includes(:procedure)
.map(&:procedure)
.uniq
2019-09-12 11:26:22 +02:00
.filter(&:publiee?)
@popular_demarches = Procedure
.includes(:service)
.select("procedures.*, COUNT(*) AS procedures_count")
.joins(:dossiers)
.publiees
2018-10-25 15:11:12 +02:00
.where(dossiers: { created_at: 7.days.ago..Time.zone.now })
.group("procedures.id")
.order("procedures_count DESC")
.limit(5)
end
end
end