diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 7c85dc5c4..f88b1ff21 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -70,4 +70,14 @@ module StudentWorkHelper def has_evaluation_count user,homework StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count end + + #传入分数,获取对应颜色 + def score_color score + if score + color = score >= 90 ? "c_red" : "c_green" + else + color = "c_grey" + end + color + end end \ No newline at end of file diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index 22df921ec..abbd134b0 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -12,18 +12,22 @@ <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>