allow posa-cards to indicate if are test cards. not used; just tracked atm
This commit is contained in:
parent
175d6d458e
commit
c7804aebf1
|
|
@ -10,14 +10,15 @@ ActiveAdmin.register_page "POSA Card Uploads" do
|
|||
file = params[:jam_ruby_posa_card][:csv]
|
||||
array_of_arrays = CSV.read(file.tempfile.path)
|
||||
array_of_arrays.each do |row|
|
||||
if row.length != 4
|
||||
raise "UKNONWN CSV FORMAT! Must be 4 columns"
|
||||
if row.length != 5
|
||||
raise "UKNONWN CSV FORMAT! Must be 5 columns"
|
||||
end
|
||||
|
||||
code = row[0]
|
||||
lesson_package_type = row[1]
|
||||
preactivate = row[2].strip == "true"
|
||||
requires_purchase = row[3].strip == "true"
|
||||
preactivate = row[2].strip.downcase == "true"
|
||||
requires_purchase = row[3].downcase== "true"
|
||||
is_test = row[4].strip.downcase == "true"
|
||||
|
||||
posa_card = PosaCard.new
|
||||
posa_card.code = code
|
||||
|
|
@ -26,6 +27,7 @@ ActiveAdmin.register_page "POSA Card Uploads" do
|
|||
posa_card.requires_purchase = requires_purchase
|
||||
posa_card.purchased = !requires_purchase
|
||||
posa_card.card_type = params[:jam_ruby_posa_card][:card_type]
|
||||
posa_card.is_test = is_test
|
||||
|
||||
|
||||
if posa_card.card_type == PosaCard::JAM_CLASS_4
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
ALTER TABLE users ADD COLUMN under_13 BOOLEAN;
|
||||
ALTER TABLE users ADD COLUMN via_amazon BOOLEAN;
|
||||
ALTER TABLE posa_cards ADD COLUMN is_test BOOLEAN DEFAULT FALSE;
|
||||
Loading…
Reference in New Issue