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