Skip to content

Commit

Permalink
turns out some new columns were redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewroth committed Dec 13, 2024
1 parent 7007fad commit f01aed7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
8 changes: 0 additions & 8 deletions db/migrate/20241212235258_add_extra_fields_to_gift_cards.rb

This file was deleted.

9 changes: 4 additions & 5 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
issuance.card_amount = 0
issuance.quantity = 0
issuance.save!

issuance.update_column(:status, "issued")
issuance = Issuance.find(issuance.id)

[ gct, issuance ]
end.to_h

Expand All @@ -121,11 +125,11 @@
gc.gift_card_type = gct
gc.expiration_date = DateTime.parse(row["expirationDate"])
gc.registrations_available = row["numberRegistrations"].to_i
gc.certificate_value = row["certificateValue"].to_d
gc.gl_code = row["glCode"].to_d
gc.created_at = row["addDate"].to_d
gc.updated_at = row["modifiedDate"].to_d
gc.associated_product = row["associatedProduct"].to_d
gc.certificate_value = row["certificateValue"]
gc.gl_code = row["glCode"]
gc.created_at = DateTime.parse(row["addDate"]) if row["created_at"]
gc.updated_at = DateTime.parse(row["modifiedDate"]) if row["modifiedDate"]
gc.associated_product = row["associatedProduct"]

batch << gc

Expand All @@ -140,5 +144,3 @@
Issuance.where(quantity: [nil, 0]).each do |i|
i.update(quantity: i.gift_cards.count)
end

Issuance.update_column(:status, "issued")

0 comments on commit f01aed7

Please sign in to comment.