diff --git a/admin/.gitignore b/admin/.gitignore index dd5c3773f..d70c888de 100644 --- a/admin/.gitignore +++ b/admin/.gitignore @@ -20,4 +20,4 @@ artifacts *.iml .idea BUILD_NUMBER -Gemfile.lock +# Gemfile.lock diff --git a/admin/app/admin/posa_card_upload.rb b/admin/app/admin/posa_card_upload.rb index 73fed6cf0..1fb35bd3d 100644 --- a/admin/app/admin/posa_card_upload.rb +++ b/admin/app/admin/posa_card_upload.rb @@ -43,6 +43,8 @@ ActiveAdmin.register_page "POSA Card Uploads" do redirect_to admin_posa_card_uploads_path, :notice => "Created #{array_of_arrays.length} POSA cards!" end + + end =begin @@ -59,6 +61,45 @@ ActiveAdmin.register_page "POSA Card Uploads" do f.actions end + +# fr manual entry of huge CSVs from rails c command line + + PosaCard.transaction do + + + array_of_arrays = CSV.read('codes.csv') + array_of_arrays.each do |row| + 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.downcase == "true" + requires_purchase = row[3].downcase== "true" + is_test = row[4].strip.downcase == "true" + + posa_card = PosaCard.new + posa_card.code = code + posa_card.lesson_package_type = LessonPackageType.find(lesson_package_type) + posa_card.preactivate = preactivate + posa_card.requires_purchase = requires_purchase + posa_card.purchased = !requires_purchase + posa_card.card_type = 'jam_class_2' + posa_card.is_test = is_test + + + if posa_card.card_type == PosaCard::JAM_CLASS_4 + posa_card.is_lesson = true + posa_card.credits = 4 + elsif posa_card.card_type == PosaCard::JAM_CLASS_2 + posa_card.is_lesson = true + posa_card.credits = 2 + end + posa_card.origin = 'posa-cards-amazon-test-drive-paid-4-50k.csv' + posa_card.save! + end + end =end content do diff --git a/admin/build b/admin/build index 64c48f159..a1c377e7f 100755 --- a/admin/build +++ b/admin/build @@ -23,7 +23,7 @@ cp ../ruby/jam_ruby-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy j # put all dependencies into vendor/bundle #rm -rf vendor/bundle -- let jenkins config 'wipe workspace' decide this -rm Gemfile.lock # if we don't want versions to float, pin it in the Gemfile, not count on Gemfile.lock +# rm Gemfile.lock # if we don't want versions to float, pin it in the Gemfile, not count on Gemfile.lock bundle install --path vendor/bundle #bundle update diff --git a/ruby/.gitignore b/ruby/.gitignore index 76db742a2..203591512 100644 --- a/ruby/.gitignore +++ b/ruby/.gitignore @@ -3,7 +3,7 @@ .bundle .config .yardoc -Gemfile.lock +# Gemfile.lock InstalledFiles _yardoc coverage diff --git a/web/.gitignore b/web/.gitignore index bad3bac3a..d8f22f053 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -29,7 +29,7 @@ jt_metadata.json artifacts -Gemfile.lock +#Gemfile.lock .sass-cache log/development.log.age log/test.log.age diff --git a/web/build b/web/build index 5d2d4f12d..4bdb6b42a 100755 --- a/web/build +++ b/web/build @@ -11,7 +11,7 @@ mkdir $DIR/target/deb #rm -rf vendor/bundle -- let jenkins config wipe workspace, or not rm -rf tmp/capybara -rm -f Gemfile.lock # if we don't want versions to float, pin it in the Gemfile, not count on Gemfile.lock +#rm -f Gemfile.lock # if we don't want versions to float, pin it in the Gemfile, not count on Gemfile.lock # put all dependencies into vendor/bundle # default build number to 1 if not found diff --git a/web/lib/tasks/lesson.rake b/web/lib/tasks/lesson.rake index 9fb3ad0e3..764d154a2 100644 --- a/web/lib/tasks/lesson.rake +++ b/web/lib/tasks/lesson.rake @@ -60,20 +60,20 @@ namespace :lessons do task amazon_gift_cards: :environment do|task, args| CSV.open("posa-cards-amazon-test-drive-paid-4.csv", "wb") do |csv| - for i in 1..250 - csv << [generate(), 'amazon-test-drive-paid-4', true, true] + for i in 1..50000 + csv << [generate(), 'amazon-test-drive-paid-4', true, true, false] end end CSV.open("posa-cards-amazon-test-drive-free-4.csv", "wb") do |csv| - for i in 1..250 - csv << [generate(), 'amazon-test-drive-free-4',true, false] + for i in 1..50000 + csv << [generate(), 'amazon-test-drive-free-4',true, false, false] end end CSV.open("posa-cards-amazon-test-drive-free-2.csv", "wb") do |csv| - for i in 1..250 - csv << [generate(), 'amazon-test-drive-free-2',true, false] + for i in 1..50000 + csv << [generate(), 'amazon-test-drive-free-2',true, false, false] end end end diff --git a/websocket-gateway/.gitignore b/websocket-gateway/.gitignore index 659252d4d..9dec59c30 100644 --- a/websocket-gateway/.gitignore +++ b/websocket-gateway/.gitignore @@ -3,7 +3,7 @@ .bundle .config .yardoc -Gemfile.lock +#Gemfile.lock InstalledFiles _yardoc coverage