From 09647a26832983e9574a7916aa40e5e5bea54e12 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 30 May 2019 12:39:36 +0800 Subject: [PATCH] =?UTF-8?q?D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190530025028_migrate_homework_end_time.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/migrate/20190530025028_migrate_homework_end_time.rb b/db/migrate/20190530025028_migrate_homework_end_time.rb index 50b496d7..cff8d8d8 100644 --- a/db/migrate/20190530025028_migrate_homework_end_time.rb +++ b/db/migrate/20190530025028_migrate_homework_end_time.rb @@ -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