From 4a9ff2939107439b39415b65256b435ea6ab1b53 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 12 Mar 2019 15:34:30 +0100 Subject: [PATCH] Fix administration page --- app/models/administrateur.rb | 1 + app/views/root/administration.html.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index 26f998d20..6d1de0927 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -15,6 +15,7 @@ class Administrateur < ApplicationRecord before_validation -> { sanitize_email(:email) } scope :inactive, -> { where(active: false) } + scope :with_publiees_ou_archivees, -> { joins(:procedures).where(procedures: { aasm_state: [:publiee, :archivee] }) } validate :password_complexity, if: Proc.new { |a| Devise.password_length.include?(a.password.try(:size)) } diff --git a/app/views/root/administration.html.haml b/app/views/root/administration.html.haml index 05c171a87..fc80e2490 100644 --- a/app/views/root/administration.html.haml +++ b/app/views/root/administration.html.haml @@ -131,7 +131,7 @@ %ul.numbers %li.number .number-value - = number_with_delimiter(Procedure.includes(:administrateur).publiees_ou_archivees.map(&:administrateur).uniq.count, :locale => :fr) + = number_with_delimiter(Administrateur.with_publiees_ou_archivees.uniq.count, :locale => :fr) .number-label< administrations %br<>