教师作业列表增加当前作业提交信息,匿评信息提示
This commit is contained in:
parent
48aacc70c9
commit
14db93c10a
|
@ -1911,19 +1911,13 @@ module ApplicationHelper
|
|||
def anonymous_comment_link(bid, course)
|
||||
link = case bid.comment_status
|
||||
when 0
|
||||
@student_size ||= searchStudent(course).size
|
||||
@homework_size = bid.homeworks.size
|
||||
percent = @homework_size.to_f / @student_size
|
||||
confirm_info = "开启匿评后学生将不能对作业进行提交、修改、删除等操作\n"
|
||||
confirm_info += percent >= 0.8 ? '' : "目前#{@student_size}个学生,总共提交了#{@homework_size}份作业,只占#{number_to_percentage(percent * 100, precision: 1)}\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
|
||||
@student_size ||= searchStudent(course).size
|
||||
@homework_size = bid.homeworks.size
|
||||
percent = @homework_size.to_f / @student_size
|
||||
confirm_info = "关闭匿评后所有同学将看到匿评的结果。学生将可以自由的进行公开互评了,但公开互评不影响作业的匿名评分\n"
|
||||
confirm_info += "" # TODO 当前有多少学生完成了匿评,有多少学生没有进行匿评,并据此给出建议:建议老师暂缓关闭匿评,因为只有x%的学生完成了匿评任务。。。
|
||||
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
|
||||
|
@ -1931,4 +1925,33 @@ module ApplicationHelper
|
|||
end
|
||||
content_tag('span', link, id: "#{bid.id}_anonymous_comment")
|
||||
end
|
||||
|
||||
def anonymous_comment_notice(bid, course)
|
||||
link =
|
||||
case bid.comment_status
|
||||
when 0
|
||||
@student_size ||= searchStudent(course).size
|
||||
@homework_size = bid.homeworks.size
|
||||
percent = @homework_size.to_f / @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
|
||||
confirm_info = "目前总共分配了#{@homework_evaluations}份匿评作业,已评价#{@has_evaluations}份作业,占#{number_to_percentage(percent * 100, precision: 1)}\n"
|
||||
end
|
||||
confirm_info
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,3 +65,9 @@
|
|||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if is_teacher %>
|
||||
<span style="color: red;">
|
||||
<%= anonymous_comment_notice(@bid, @bid.courses.first) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue