From 54aae26cbe3f69ff04649b991e4f21c874ebea3d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 17:23:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A2=AB=E9=99=A4=E6=95=B0=E4=B8=BA0=E6=97=B6?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a5ff44417..8544b2cf3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1931,7 +1931,7 @@ module ApplicationHelper when 0 @student_size ||= searchStudent(course).size @homework_size = bid.homeworks.size - percent = @homework_size.to_f / @student_size + percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size) confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n" when 1 @homework_evaluations = 0 @@ -1948,7 +1948,7 @@ module ApplicationHelper @has_evaluations = 0 bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count} - percent = @has_evaluations.to_f / @homework_evaluations + percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations) confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n" end confirm_info