revert hard coded Guthaben

automatic_group_order_invoice
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

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_11_28_133642) do
ActiveRecord::Schema[7.0].define(version: 2023_12_11_121430) do
create_table "action_text_rich_texts", charset: "utf8mb4", force: :cascade do |t|
t.string "name", null: false
t.text "body", size: :long