From cb891f21d409d6253a8cb361ab2c8c28bb4706a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 7 Nov 2018 14:10:05 +0100 Subject: [PATCH] Simplify count_rows check We had a line which was too long according to rubocop, and simplifying the code makes the line shorter. --- lib/tasks/migrate_milestones_and_statuses.rake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/tasks/migrate_milestones_and_statuses.rake b/lib/tasks/migrate_milestones_and_statuses.rake index a16b9479e..e46db0a20 100644 --- a/lib/tasks/migrate_milestones_and_statuses.rake +++ b/lib/tasks/migrate_milestones_and_statuses.rake @@ -80,10 +80,15 @@ namespace :milestones do 'description' => 'description'} puts "Verifying that all rows were copied..." - unless count_rows('milestones') == count_rows('budget_investment_milestones') && - count_rows('milestone_statuses') == count_rows('budget_investment_statuses') && - count_rows('milestone_translations') == count_rows('budget_investment_milestone_translations') - raise "Number of rows of old and new tables do not match! Rolling back transaction..." + + { + "budget_investment_milestones" => "milestones", + "budget_investment_statuses" => "milestone_statuses", + "budget_investment_milestone_translations" => "milestone_translations" + }.each do |original_table, migrated_table| + unless count_rows(original_table) == count_rows(migrated_table) + raise "Number of rows of old and new tables do not match! Rolling back transaction..." + end end end