扣分规则显示

dev_cxt2
sw 10 years ago
parent a979b490e2
commit e73517cfd0

@ -3,7 +3,8 @@ module HomeworkCommonHelper
#迟交扣分下拉框 #迟交扣分下拉框
def late_penalty_option def late_penalty_option
type = [] type = []
for i in (0..5) type << l(:lable_unset)
for i in (1..5)
option = [] option = []
option << i option << i
option << i option << i
@ -29,7 +30,8 @@ module HomeworkCommonHelper
#缺评扣分 #缺评扣分
def absence_penalty_option def absence_penalty_option
type = [] type = []
i = 0 i = 1
type << l(:lable_unset)
while i <= 5 while i <= 5
option = [] option = []
option << i option << i
@ -50,4 +52,32 @@ module HomeworkCommonHelper
end end
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

@ -61,15 +61,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>

@ -2025,6 +2025,7 @@ zh:
label_evaluation_time: 匿评时间 label_evaluation_time: 匿评时间
label_file_lost_list: 缺失文件列表 label_file_lost_list: 缺失文件列表
lable_unset: 未设置

Loading…
Cancel
Save