-
Notifications
You must be signed in to change notification settings - Fork 13
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 #45 from CDL-Dryad/shopping-cart-report
Shopping cart report
- Loading branch information
Showing
16 changed files
with
222 additions
and
42 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
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
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
stash/stash_engine/db/migrate/20200111013011_add_payment_type.rb
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,32 @@ | ||
class AddPaymentType < ActiveRecord::Migration | ||
def up | ||
rename_column :stash_engine_identifiers, :invoice_id, :payment_id | ||
add_column :stash_engine_identifiers, :payment_type, :string, after: :search_words | ||
StashEngine::Identifier.reset_column_information | ||
StashEngine::Identifier.all.each do |i| | ||
if i.payment_id | ||
if i.payment_id.start_with?('in_') | ||
i.update_column(:payment_type, 'stripe') | ||
else | ||
# else, separate on the colon, set payment_type to part before colon, and payment_id to rest | ||
found_type, found_id = i.payment_id.match(/(.+):(.+)/).captures | ||
next unless found_type && found_id | ||
i.update_column(:payment_id, found_id) | ||
i.update_column(:payment_type, found_type) | ||
end | ||
end | ||
end | ||
end | ||
|
||
def down | ||
StashEngine::Identifier.all.each do |i| | ||
next unless i.payment_id | ||
if i.payment_type != 'stripe' | ||
new_id = "#{i.payment_type}:#{i.payment_id}" | ||
i.update_column(:payment_id, new_id) | ||
end | ||
end | ||
rename_column :stash_engine_identifiers, :payment_id, :invoice_id | ||
remove_column :stash_engine_identifiers, :payment_type | ||
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
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
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
Oops, something went wrong.