修复进入课程作业报错的问题
This commit is contained in:
parent
76db0e61c3
commit
65c137e617
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue