Fix Rubocop issues
This commit is contained in:
parent
a45008640f
commit
7f5d06b23c
27 changed files with 94 additions and 83 deletions
|
|
@ -1,17 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
namespace :registrations do
|
||||
desc "Create missing registrations for those how have a registration ticket."
|
||||
task :create_missing, [:conference] => :environment do |t, args|
|
||||
desc 'Create missing registrations for those how have a registration ticket.'
|
||||
task :create_missing, [:conference] => :environment do |_t, args|
|
||||
|
||||
fail 'Please supply a conference short name.' unless args.conference
|
||||
raise 'Please supply a conference short name.' unless args.conference
|
||||
|
||||
conf = Conference.find_by(short_title: args.conference)
|
||||
# Check if a user is found based on the supplied email address
|
||||
fail "Coud not find conference #{args.conference}" unless conf
|
||||
raise "Coud not find conference #{args.conference}" unless conf
|
||||
|
||||
purchases = conf.ticket_purchases.where(ticket: conf.registration_tickets, paid: true)
|
||||
unregistered = purchases.select { |tp| !conf.user_registered?(tp.user) }
|
||||
unregistered = purchases.reject { |tp| conf.user_registered?(tp.user) }
|
||||
puts "Found #{unregistered.count} unregistered users for #{purchases.count} ticket purchases."
|
||||
puts "There are currently #{conf.participants.count} registered users."
|
||||
|
||||
|
|
@ -19,17 +19,17 @@ namespace :registrations do
|
|||
puts "Creating registration for #{tp.user.email}"
|
||||
Registration.create(user: tp.user, conference: conf)
|
||||
end
|
||||
puts "Done."
|
||||
puts 'Done.'
|
||||
end
|
||||
|
||||
desc "Show User emails who have not paid, but did register"
|
||||
task :list_unpaid, [:conference] => :environment do |t, args|
|
||||
desc 'Show User emails who have not paid, but did register'
|
||||
task :list_unpaid, [:conference] => :environment do |_t, args|
|
||||
|
||||
fail 'Please supply a conference short name.' unless args.conference
|
||||
raise 'Please supply a conference short name.' unless args.conference
|
||||
|
||||
conf = Conference.find_by(short_title: args.conference)
|
||||
# Check if a user is found based on the supplied email address
|
||||
fail "Coud not find conference #{args.conference}" unless conf
|
||||
raise "Coud not find conference #{args.conference}" unless conf
|
||||
|
||||
registered = conf.participants
|
||||
unpaid = registered.select do |user|
|
||||
|
|
@ -41,6 +41,6 @@ namespace :registrations do
|
|||
unpaid.each do |user|
|
||||
puts "'#{user.name}'<#{user.email}>, "
|
||||
end
|
||||
puts ""
|
||||
puts ''
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue