|
|
|
@ -2347,4 +2347,32 @@ module ApplicationHelper
|
|
|
|
|
def text_format text
|
|
|
|
|
text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","<br/>").html_safe
|
|
|
|
|
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 += ",请 " + 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 += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
notice = "迟交扣#{late_penalty}分"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
notice.html_safe
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|