fix(data): normalize invalid Champs::RNAChamp.values in db

This commit is contained in:
mfo 2024-08-21 18:00:01 +02:00
parent abb2fa159c
commit 22e50d4c9e
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Maintenance
class NormalizeRNAValuesTask < MaintenanceTasks::Task
def collection
Champs::RNAChamp.where.not(value: nil)
end
def process(element)
if /\s/.match?(element.value)
element.update_column(:value, element.value.gsub(/\s+/, ''))
end
end
def count
# to costly
end
end
end