From 65c137e6171fb140c7db542d4433ce79d0d5c016 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 10 Jul 2014 11:27:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9B=E5=85=A5=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 6 ++++++ db/schema.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4b6a84b57..b4b89bb0f 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -343,6 +343,9 @@ module CoursesHelper #获取作业的互评得分 def student_score_for_homework homework member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first + if member.nil? + return "0.00" + end student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars") student_stars_count = 0 student_stars.each do |star| @@ -354,6 +357,9 @@ module CoursesHelper #获取作业的教师评分 def teacher_score_for_homework homework member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first + if member.nil? + return "0.00" + end teacher_stars = homework.rates(:quality).where("rater_id = #{member.user_id}").select("stars").first return format("%.2f",teacher_stars == nil ? 0 : teacher_stars.stars) end diff --git a/db/schema.rb b/db/schema.rb index 72d49adf4..26c82491d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140704034832) do +ActiveRecord::Schema.define(:version => 20140708023356) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false