缺评、迟交扣分还是改为 直接扣多少分
This commit is contained in:
parent
fa9008d396
commit
22d4499f8f
|
@ -218,11 +218,11 @@ class HomeworkCommonController < ApplicationController
|
||||||
#关闭匿评
|
#关闭匿评
|
||||||
def stop_anonymous_comment
|
def stop_anonymous_comment
|
||||||
@homework_detail_manual.update_column('comment_status', 3)
|
@homework_detail_manual.update_column('comment_status', 3)
|
||||||
#计算缺评扣分---->计算缺评数量
|
#计算缺评扣分
|
||||||
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||||
@homework.student_works.each do |student_work|
|
@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
|
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 : 0
|
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
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class StudentWorkController < ApplicationController
|
||||||
render_attachment_warning_if_needed(student_work)
|
render_attachment_warning_if_needed(student_work)
|
||||||
#提交作品时,计算是否迟交
|
#提交作品时,计算是否迟交
|
||||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||||
student_work.late_penalty = 1
|
student_work.late_penalty = @homework.late_penalty
|
||||||
else
|
else
|
||||||
student_work.late_penalty = 0
|
student_work.late_penalty = 0
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue