作品列表扣分规则显示

This commit is contained in:
sw 2015-07-18 10:44:26 +08:00
parent 94ed3501f8
commit 42d706a961
3 changed files with 30 additions and 34 deletions

View File

@ -2347,4 +2347,32 @@ module ApplicationHelper
def text_format text def text_format text
text.gsub("&","&amp;").gsub("<","&lt;").gsub(">","&gt;").gsub("\n","<br/>").html_safe text.gsub("&","&amp;").gsub("<","&lt;").gsub(">","&gt;").gsub("\n","<br/>").html_safe
end end
#评分规则显示
def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
if absence_penalty
if late_penalty.to_i == 0 && absence_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}"
elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}"
end
else
if late_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
else
notice = "迟交扣#{late_penalty}"
end
end
notice.html_safe
end
end end

View File

@ -53,31 +53,4 @@ module HomeworkCommonHelper
link link
end end
#评分规则显示
def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
if absence_penalty
if late_penalty.to_i == 0 && absence_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}"
elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}"
end
else
if late_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
else
notice = "迟交扣#{late_penalty}"
end
end
notice.html_safe
end
end end

View File

@ -165,15 +165,10 @@
<div class="mt5"> <div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span> <span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red"> <div class="fl mb5 c_red">
迟交扣
<%= @homework.late_penalty%>
<% if @homework.homework_type == 1%> <% if @homework.homework_type == 1%>
,缺评一个作品扣 <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%>
<%= @homework.homework_detail_manual.absence_penalty%>
<% else%> <% else%>
<%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%>
<% end%> <% end%>
</div> </div>
</div> </div>