|
|
|
@ -2156,48 +2156,48 @@ module ApplicationHelper
|
|
|
|
|
|
|
|
|
|
def anonymous_comment_link(bid, course)
|
|
|
|
|
link = case bid.comment_status
|
|
|
|
|
when 0
|
|
|
|
|
confirm_info = "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n"
|
|
|
|
|
confirm_info += anonymous_comment_notice(bid,course)
|
|
|
|
|
confirm_info += '是否确定开启匿评?'
|
|
|
|
|
link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
|
|
|
|
|
when 1
|
|
|
|
|
confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作业列表\n"
|
|
|
|
|
confirm_info += anonymous_comment_notice(bid,course)
|
|
|
|
|
confirm_info += '是否确定关闭匿评?'
|
|
|
|
|
link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
|
|
|
|
|
when 2
|
|
|
|
|
'匿评结束'
|
|
|
|
|
end
|
|
|
|
|
when 0
|
|
|
|
|
confirm_info = "开启匿评后学生将不能对作品进行提交、修改、删除等操作\n"
|
|
|
|
|
confirm_info += anonymous_comment_notice(bid,course)
|
|
|
|
|
confirm_info += '是否确定开启匿评?'
|
|
|
|
|
link_to '启动匿评', start_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, :confirm => confirm_info, disable_with: '加载中...'
|
|
|
|
|
when 1
|
|
|
|
|
confirm_info = "关闭匿评后所有同学将不能继续进行匿评,且将公开已提交作品列表\n"
|
|
|
|
|
confirm_info += anonymous_comment_notice(bid,course)
|
|
|
|
|
confirm_info += '是否确定关闭匿评?'
|
|
|
|
|
link_to '关闭匿评', stop_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true, :confirm => confirm_info
|
|
|
|
|
when 2
|
|
|
|
|
'匿评结束'
|
|
|
|
|
end
|
|
|
|
|
content_tag('span', link, id: "#{bid.id}_anonymous_comment")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def anonymous_comment_notice(bid, course)
|
|
|
|
|
case bid.comment_status
|
|
|
|
|
when 0
|
|
|
|
|
@student_size ||= searchStudent(course).size
|
|
|
|
|
@homework_size = bid.homeworks.size
|
|
|
|
|
percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
|
|
|
|
|
confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
|
|
|
|
when 1
|
|
|
|
|
@homework_evaluations = 0
|
|
|
|
|
bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
|
|
|
|
|
teachers = "("
|
|
|
|
|
teacher_members = searchTeacherAndAssistant(course)
|
|
|
|
|
teacher_members.each do |member|
|
|
|
|
|
if member == teacher_members.last
|
|
|
|
|
teachers += member.user_id.to_s + ")"
|
|
|
|
|
else
|
|
|
|
|
teachers += member.user_id.to_s + ","
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@has_evaluations = 0
|
|
|
|
|
bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
|
|
|
|
|
|
|
|
|
|
percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
|
|
|
|
|
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
|
|
|
|
end
|
|
|
|
|
confirm_info
|
|
|
|
|
case bid.comment_status
|
|
|
|
|
when 0
|
|
|
|
|
@student_size ||= searchStudent(course).size
|
|
|
|
|
@homework_size = bid.homeworks.size
|
|
|
|
|
percent = @homework_size.to_f / (@student_size == 0 ? 1 : @student_size)
|
|
|
|
|
confirm_info = "目前#{@student_size}个学生,总共提交了#{@homework_size}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
|
|
|
|
when 1
|
|
|
|
|
@homework_evaluations = 0
|
|
|
|
|
bid.homeworks.map { |homework| @homework_evaluations += homework.homework_evaluations.count}
|
|
|
|
|
teachers = "("
|
|
|
|
|
teacher_members = searchTeacherAndAssistant(course)
|
|
|
|
|
teacher_members.each do |member|
|
|
|
|
|
if member == teacher_members.last
|
|
|
|
|
teachers += member.user_id.to_s + ")"
|
|
|
|
|
else
|
|
|
|
|
teachers += member.user_id.to_s + ","
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@has_evaluations = 0
|
|
|
|
|
bid.homeworks.map { |homework| @has_evaluations += homework.rates(:quality).where("seems_rateable_rates.rater_id not in #{teachers}").count}
|
|
|
|
|
|
|
|
|
|
percent = @has_evaluations.to_f / (@homework_evaluations == 0 ? 1 : @homework_evaluations)
|
|
|
|
|
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作品,已评价#{@has_evaluations}份作品,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
|
|
|
|
end
|
|
|
|
|
confirm_info
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_technical_title user
|
|
|
|
@ -2218,4 +2218,23 @@ module ApplicationHelper
|
|
|
|
|
request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#获取指定资源列表的TAG的集合以及每个TAG的数量,降序排序
|
|
|
|
|
def attachment_tag_list attachments
|
|
|
|
|
tag_list = Hash.new
|
|
|
|
|
attachments.each do |attachment|
|
|
|
|
|
attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1}
|
|
|
|
|
end
|
|
|
|
|
tag_list.sort {|a,b| b[1]<=>a[1]}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#获取课程资源的TAG云
|
|
|
|
|
def get_course_tag_list course
|
|
|
|
|
all_attachments = course.attachments.select{|attachment| attachment.is_public? ||
|
|
|
|
|
(attachment.container_type == "Course" && User.current.member_of_course?(course))||
|
|
|
|
|
attachment.author_id == User.current.id
|
|
|
|
|
}
|
|
|
|
|
tag_list = attachment_tag_list all_attachments
|
|
|
|
|
tag_list
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|