迟交和缺评扣分,修改为0后继续修改有问题
This commit is contained in:
parent
4eb9ce6f0f
commit
2938679795
|
@ -92,7 +92,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
@homework.publish_time = params[:homework_common][:publish_time]
|
@homework.publish_time = params[:homework_common][:publish_time]
|
||||||
@homework.homework_type = params[:homework_common][:homework_type]
|
@homework.homework_type = params[:homework_common][:homework_type]
|
||||||
unless @homework.late_penalty == params[:late_penalty]
|
unless @homework.late_penalty == params[:late_penalty]
|
||||||
@homework.student_works.where("late_penalty != 0").each do |student_work|
|
@homework.student_works.where("created_at > #{@homework.end_time}").each do |student_work|
|
||||||
student_work.late_penalty = params[:late_penalty]
|
student_work.late_penalty = params[:late_penalty]
|
||||||
student_work.save
|
student_work.save
|
||||||
end
|
end
|
||||||
|
@ -108,8 +108,10 @@ class HomeworkCommonController < ApplicationController
|
||||||
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||||
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
|
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
|
||||||
if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||||
@homework.student_works.where("absence_penalty != 0").each do |student_work|
|
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||||
student_work.absence_penalty = student_work.absence_penalty / @homework_detail_manual.absence_penalty * params[:absence_penalty].to_i
|
@homework.student_works.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}").count
|
||||||
|
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||||
student_work.save
|
student_work.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue