more idiomatic count

This commit is contained in:
clemkeirua 2020-09-24 15:14:23 +02:00 committed by Keirua (Rebase PR Action)
parent f7ebbdc7c2
commit 2cb3b1c68e

View file

@ -360,7 +360,7 @@ class StatsController < ApplicationController
if weekly_dossiers_count == 0
result = 0
else
weekly_dossier_with_avis_count = weekly_dossiers.filter { |dossier| dossier.avis.present? }.count
weekly_dossier_with_avis_count = weekly_dossiers.count { |dossier| dossier.avis.present? }
result = percentage(weekly_dossier_with_avis_count, weekly_dossiers_count)
end