From 469f1c36637cd3fde67ccbffb36b64e059a5bfd5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 13:56:55 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A4=A7=E4=BA=8E90=E5=88=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=BA=A2=E8=89=B2=EF=BC=8C=E5=B0=8F=E4=BA=8E?= =?UTF-8?q?90=E5=88=86=E6=98=BE=E7=A4=BA=E7=BB=BF=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E8=AF=84=E5=88=86=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=81=B0?= =?UTF-8?q?=E8=89=B2=202=E3=80=81=E8=BF=9F=E4=BA=A4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/student_work_helper.rb | 10 ++++++++++ app/views/student_work/_student_work.html.erb | 16 ++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) 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"%>