作业匿评的结束状态未更新
This commit is contained in:
parent
cf8e2fab08
commit
ebeaac5798
|
@ -963,7 +963,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) do
|
|||
t.integer "course_group_id", :default => 0
|
||||
end
|
||||
|
||||
add_index "members", ["course_id"], :name => "index_members_on_course_id"
|
||||
add_index "members", ["project_id"], :name => "index_members_on_project_id"
|
||||
add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
|
||||
add_index "members", ["user_id"], :name => "index_members_on_user_id"
|
||||
|
|
|
@ -2,12 +2,20 @@ namespace :delete_evalution do
|
|||
desc "delete evaluation"
|
||||
task :delete => :environment do
|
||||
homework = HomeworkCommon.where("id = 844").first
|
||||
homework.homework_detail_manual.update_column('comment_status', 3)
|
||||
homework_detail_manual = homework.homework_detail_manual
|
||||
homework_detail_manual.update_column('comment_status', 3)
|
||||
student_work_score = StudentWorksScore.where("student_work_id = 28088 and user_id = 9263").first
|
||||
student_work_score.destroy
|
||||
student_work_9203 = StudentWork.where("id = 28088").first
|
||||
student_work_9263 = StudentWork.where("homework_common_id = 844 and user_id = 9263").first
|
||||
student_work_9203.update_column("student_score",91)
|
||||
student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework.homework_detail_manual.absence_penalty)
|
||||
student_work_9203.update_column("final_score",91)
|
||||
student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework_detail_manual.absence_penalty)
|
||||
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 * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
end
|
|
@ -52,7 +52,7 @@ namespace :homework_evaluation do
|
|||
|
||||
#自动关闭匿评的任务
|
||||
task :end_evaluation => :environment do
|
||||
homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'")
|
||||
homework_detail_manuals = HomeworkDetailManual.where("evaluation_end <= '#{Date.today}'")
|
||||
homework_detail_manuals.each do |homework_detail_manual|
|
||||
homework_common = homework_detail_manual.homework_common
|
||||
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
|
||||
|
|
Loading…
Reference in New Issue