pre_develop
cxt 6 years ago
parent 9aedab22d8
commit 09647a2683

@ -6,7 +6,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '#{homework.end_time}'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end
@ -20,7 +20,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-05-20 00:00:00'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end
@ -35,7 +35,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-05-29 00:00:00'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end
@ -50,7 +50,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-10 00:00:00'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end
@ -65,7 +65,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-16 00:00:00'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end
@ -80,7 +80,7 @@ class MigrateHomeworkEndTime < ActiveRecord::Migration
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-17 00:00:00'").each do |work|
work.work_status = 1
work.late_penalty = 0
score = work.final_score + work.eff_score - work.late_penalty
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
work.save
end

Loading…
Cancel
Save