缺评、迟交扣分还是改为 直接扣多少分

This commit is contained in:
sw 2015-09-17 10:06:04 +08:00
parent fa9008d396
commit 22d4499f8f
2 changed files with 3 additions and 3 deletions

View File

@ -218,11 +218,11 @@ class HomeworkCommonController < ApplicationController
#关闭匿评
def stop_anonymous_comment
@homework_detail_manual.update_column('comment_status', 3)
#计算缺评扣分---->计算缺评数量
#计算缺评扣分
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@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 : 0
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end

View File

@ -116,7 +116,7 @@ class StudentWorkController < ApplicationController
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")
student_work.late_penalty = 1
student_work.late_penalty = @homework.late_penalty
else
student_work.late_penalty = 0
end