socialforge/app/helpers/homework_common_helper.rb

53 lines
1.1 KiB
Ruby
Raw Normal View History

# encoding: utf-8
module HomeworkCommonHelper
#迟交扣分下拉框
def late_penalty_option
type = []
2015-06-04 10:32:59 +08:00
for i in (0..5)
option = []
option << i
option << i
type << option
end
type
end
#教辅评分比例下拉框
def ta_proportion_option
type = []
i = 0
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-06-04 10:32:59 +08:00
i = 0
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
end