班级作业:如图勾选了不参加匿评扣分,但最终得分却没扣分
This commit is contained in:
parent
37c80900c0
commit
c1d731185a
|
@ -1055,6 +1055,31 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
no_anon_penalty = params[:no_anon_penalty] ? 0 : 1
|
||||
|
||||
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count != 0
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
else
|
||||
if no_anon_penalty
|
||||
student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count
|
||||
else
|
||||
student_work.absence_penalty = 0
|
||||
end
|
||||
end
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if no_anon_penalty != homework_detail_manual.no_anon_penalty
|
||||
homework_detail_manual.no_anon_penalty = no_anon_penalty
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
|
@ -1076,19 +1101,6 @@ class StudentWorkController < ApplicationController
|
|||
homework_detail_manual.save if homework_detail_manual
|
||||
end
|
||||
|
||||
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
end
|
||||
|
||||
if params[:ta_mode] && homework_detail_manual.ta_mode.to_i != params[:ta_mode].to_i
|
||||
homework_detail_manual.ta_mode = params[:ta_mode].to_i
|
||||
homework_detail_manual.save
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
alert('关闭成功');
|
||||
<% if @hw_status == 5 %>
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||
window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>';
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue