revert hard coded Guthaben

This commit is contained in:
viehlieb 2023-12-11 13:43:12 +01:00
parent bcc647dabb
commit bdeee02873
2 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,15 @@
class ChangeGroupOrderInvoicePaymentMethod < ActiveRecord::Migration[7.0]
def change
GroupOrderInvoice.all.each do |group_order_invoice|
case group_order_invoice.payment_method
when 'Guthaben'
group_order_invoice.payment_method = 'Guthaben'
when /\A\d+\z/
group_order_invoice.payment_method = FinancialTransactionType.find_by(id: group_order_invoice.payment_method)&.name || 'Guthaben'
else
group_order_invoice.payment_method = group_order_invoice.payment_method || 'Guthaben'
end
group_order_invoice.save!
end
end
end