-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1284 from SplitTime/oveson/fix-vmulti-duplicates
Fix historical fact vmulti duplicates
- Loading branch information
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/tasks/temp/historical_facts_fix_vmulti_duplicates.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :temp do | ||
desc "Changes imported volunteer_multi records to volunteer_multi_reported" | ||
task historical_facts_fix_vmulti_duplicates: :environment do | ||
puts "Changing volunteer_multi records to volunteer_multi_reported" | ||
|
||
historical_facts = HistoricalFact.where(kind: :volunteer_multi, year: 2024) | ||
hf_count = historical_facts.count | ||
|
||
puts "Found #{hf_count} historical facts to update" | ||
|
||
progress_bar = ::ProgressBar.new(hf_count) | ||
|
||
historical_facts.find_each do |fact| | ||
progress_bar.increment! | ||
fact.update(kind: :volunteer_multi_reported) | ||
rescue ActiveRecordError => e | ||
puts "Could not update record for HistoricalFact id: #{fact.id}" | ||
puts e | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters