1、大于90分显示红色,小于90分显示绿色,未评分,显示灰色

2、迟交显示
This commit is contained in:
sw 2015-06-19 13:56:55 +08:00
parent 857110d537
commit 469f1c3663
2 changed files with 20 additions and 6 deletions

View File

@ -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

View File

@ -12,18 +12,22 @@
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
</li>
<li class=" hwork_time_c">
06-01
<% if Time.parse(@homework.end_time.to_s) < Time.parse(student_work.created_at.to_s) %>
<span class="c_red">迟交</span>
<% else%>
<%= student_work.created_at.strftime("%m-%d").to_s%>
<% end %>
</li>
<li class=" hwork_score c_red">
<li class=" hwork_score <%= score_color student_work.teacher_score%>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
</li>
<li class=" hwork_score c_red">
<li class=" hwork_score <%= score_color student_work.teaching_asistant_score%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
</li>
<li class=" hwork_code02 <%= student_work.student_score.nil? ? 'c_grey' : 'c_red'%> student_score_info" >
<li class=" hwork_code02 <%= score_color student_work.student_score%> student_score_info" >
<%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%>
<% unless student_work.student_score.nil?%>
<span class="c_blue">
<span class="">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
</span>
<div class="info_ni">
@ -34,7 +38,7 @@
</div>
<% end%>
</li>
<li class=" hwork_score <%= student_work.final_score.nil? ? 'c_grey' : 'c_red'%>">
<li class=" hwork_score <%= score_color student_work.final_score%>">
<%= student_work.final_score.nil? ? "--" : format("%.1f",student_work.final_score)%>
</li>
<div class="cl"></div>