2015-05-19 17:12:43 +08:00
|
|
|
# encoding: utf-8
|
|
|
|
module HomeworkCommonHelper
|
2015-05-20 15:05:35 +08:00
|
|
|
#迟交扣分下拉框
|
|
|
|
def late_penalty_option
|
|
|
|
type = []
|
2015-07-10 15:34:55 +08:00
|
|
|
type << l(:lable_unset)
|
|
|
|
for i in (1..5)
|
2015-05-20 15:05:35 +08:00
|
|
|
option = []
|
|
|
|
option << i
|
|
|
|
option << i
|
|
|
|
type << option
|
|
|
|
end
|
|
|
|
type
|
|
|
|
end
|
|
|
|
|
|
|
|
#教辅评分比例下拉框
|
|
|
|
def ta_proportion_option
|
|
|
|
type = []
|
2015-07-02 16:04:26 +08:00
|
|
|
i = 0
|
2015-05-20 15:05:35 +08:00
|
|
|
while i <= 100
|
|
|
|
option = []
|
|
|
|
option << i.to_s + "%"
|
|
|
|
option << i.to_f / 100
|
|
|
|
type << option
|
|
|
|
i += 10
|
|
|
|
end
|
|
|
|
type
|
|
|
|
end
|
|
|
|
|
|
|
|
#缺评扣分
|
|
|
|
def absence_penalty_option
|
|
|
|
type = []
|
2015-07-10 15:34:55 +08:00
|
|
|
i = 1
|
|
|
|
type << l(:lable_unset)
|
2015-05-20 15:05:35 +08:00
|
|
|
while i <= 5
|
|
|
|
option = []
|
|
|
|
option << i
|
|
|
|
option << i
|
|
|
|
type << option
|
|
|
|
i += 1
|
|
|
|
end
|
|
|
|
type
|
|
|
|
end
|
2015-05-26 10:00:37 +08:00
|
|
|
|
|
|
|
#根据传入作业确定跳转到开启匿评还是关闭匿评功能
|
|
|
|
def alert_anonyoms_path homework,homework_detail_manual
|
|
|
|
link = ""
|
|
|
|
if homework_detail_manual.comment_status == 1
|
|
|
|
link = start_anonymous_comment_homework_common_url homework.id
|
|
|
|
elsif homework_detail_manual.comment_status == 2
|
|
|
|
link = stop_anonymous_comment_homework_common_url homework.id
|
|
|
|
end
|
|
|
|
link
|
|
|
|
end
|
2015-07-10 15:34:55 +08:00
|
|
|
|
|
|
|
#评分规则显示
|
|
|
|
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
|
2015-05-19 17:12:43 +08:00
|
|
|
end
|