Avoid superfluous count

This commit is contained in:
simon lehericey 2020-09-10 12:10:38 +02:00 committed by LeSim (Rebase PR Action)
parent c8cc1fc43f
commit d9c7051a00

View file

@ -30,17 +30,13 @@ module Instructeurs
.reorder(nil) .reorder(nil)
.count .count
@all_dossiers_counts = {} @all_dossiers_counts = {
@all_dossiers_counts['à suivre'] = dossiers.without_followers.en_cours.count 'à suivre' => @dossiers_a_suivre_count_per_procedure.sum { |_, v| v },
@all_dossiers_counts['suivis'] = current_instructeur 'suivis' => @followed_dossiers_count_per_procedure.sum { |_, v| v },
.followed_dossiers 'traités' => @dossiers_termines_count_per_procedure.sum { |_, v| v },
.joins(:groupe_instructeur) 'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v },
.en_cours 'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v }
.where(groupe_instructeur_id: groupe_ids) }
.count
@all_dossiers_counts['traités'] = dossiers.termine.count
@all_dossiers_counts['dossiers'] = dossiers.all_state.count
@all_dossiers_counts['archivés'] = dossiers.archived.count
end end
def show def show