From 7e2f6f006452ca4b46f3ae757bfc33fb9dfdd1b1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 4 Mar 2020 18:50:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/attendances/index.json.jbuilder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/weapps/attendances/index.json.jbuilder b/app/views/weapps/attendances/index.json.jbuilder index 9ab10de66..bff2e1218 100644 --- a/app/views/weapps/attendances/index.json.jbuilder +++ b/app/views/weapps/attendances/index.json.jbuilder @@ -17,5 +17,5 @@ json.history_attendances @history_attendances.each_with_index.to_a do |attendanc end json.all_history_count @all_history_count -json.avg_normal_rate all_normal_rate.sum / @all_history_count -json.avg_absence_rate all_absence_rate.sum / @all_history_count +json.avg_normal_rate @all_history_count == 0 ? 0 : all_normal_rate.sum / @all_history_count +json.avg_absence_rate @all_history_count == 0 ? 0 : all_absence_rate.sum / @all_history_count