Fix Rubocop issues
This commit is contained in:
parent
a4a6306198
commit
d63a22c54e
34 changed files with 151 additions and 137 deletions
|
|
@ -7,51 +7,51 @@ if Rails.env.development?
|
|||
# You can override any of these by setting an environment variable of the
|
||||
# same name.
|
||||
Annotate.set_defaults(
|
||||
'active_admin' => 'false',
|
||||
'additional_file_patterns' => [],
|
||||
'routes' => 'false',
|
||||
'models' => 'true',
|
||||
'position_in_routes' => 'before',
|
||||
'position_in_class' => 'before',
|
||||
'position_in_test' => 'before',
|
||||
'position_in_fixture' => 'before',
|
||||
'position_in_factory' => 'before',
|
||||
'position_in_serializer' => 'before',
|
||||
'show_foreign_keys' => 'true',
|
||||
'show_complete_foreign_keys' => 'false',
|
||||
'show_indexes' => 'true',
|
||||
'simple_indexes' => 'false',
|
||||
'model_dir' => 'app/models',
|
||||
'root_dir' => '',
|
||||
'include_version' => 'false',
|
||||
'require' => '',
|
||||
'exclude_tests' => 'false',
|
||||
'exclude_fixtures' => 'false',
|
||||
'exclude_factories' => 'false',
|
||||
'exclude_serializers' => 'false',
|
||||
'exclude_scaffolds' => 'true',
|
||||
'exclude_controllers' => 'true',
|
||||
'exclude_helpers' => 'true',
|
||||
'exclude_sti_subclasses' => 'false',
|
||||
'ignore_model_sub_dir' => 'false',
|
||||
'ignore_columns' => nil,
|
||||
'ignore_routes' => nil,
|
||||
'ignore_unknown_models' => 'false',
|
||||
'hide_limit_column_types' => 'integer,bigint,boolean',
|
||||
'hide_default_column_types' => 'json,jsonb,hstore',
|
||||
'skip_on_db_migrate' => 'false',
|
||||
'format_bare' => 'true',
|
||||
'format_rdoc' => 'false',
|
||||
'format_yard' => 'false',
|
||||
'format_markdown' => 'false',
|
||||
'sort' => 'false',
|
||||
'force' => 'false',
|
||||
'frozen' => 'false',
|
||||
'classified_sort' => 'true',
|
||||
'trace' => 'false',
|
||||
'wrapper_open' => nil,
|
||||
'wrapper_close' => nil,
|
||||
'with_comment' => 'true'
|
||||
'active_admin' => 'false',
|
||||
'additional_file_patterns' => [],
|
||||
'routes' => 'false',
|
||||
'models' => 'true',
|
||||
'position_in_routes' => 'before',
|
||||
'position_in_class' => 'before',
|
||||
'position_in_test' => 'before',
|
||||
'position_in_fixture' => 'before',
|
||||
'position_in_factory' => 'before',
|
||||
'position_in_serializer' => 'before',
|
||||
'show_foreign_keys' => 'true',
|
||||
'show_complete_foreign_keys' => 'false',
|
||||
'show_indexes' => 'true',
|
||||
'simple_indexes' => 'false',
|
||||
'model_dir' => 'app/models',
|
||||
'root_dir' => '',
|
||||
'include_version' => 'false',
|
||||
'require' => '',
|
||||
'exclude_tests' => 'false',
|
||||
'exclude_fixtures' => 'false',
|
||||
'exclude_factories' => 'false',
|
||||
'exclude_serializers' => 'false',
|
||||
'exclude_scaffolds' => 'true',
|
||||
'exclude_controllers' => 'true',
|
||||
'exclude_helpers' => 'true',
|
||||
'exclude_sti_subclasses' => 'false',
|
||||
'ignore_model_sub_dir' => 'false',
|
||||
'ignore_columns' => nil,
|
||||
'ignore_routes' => nil,
|
||||
'ignore_unknown_models' => 'false',
|
||||
'hide_limit_column_types' => 'integer,bigint,boolean',
|
||||
'hide_default_column_types' => 'json,jsonb,hstore',
|
||||
'skip_on_db_migrate' => 'false',
|
||||
'format_bare' => 'true',
|
||||
'format_rdoc' => 'false',
|
||||
'format_yard' => 'false',
|
||||
'format_markdown' => 'false',
|
||||
'sort' => 'false',
|
||||
'force' => 'false',
|
||||
'frozen' => 'false',
|
||||
'classified_sort' => 'true',
|
||||
'trace' => 'false',
|
||||
'wrapper_open' => nil,
|
||||
'wrapper_close' => nil,
|
||||
'with_comment' => 'true'
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,24 +13,24 @@ namespace :db do
|
|||
end
|
||||
end
|
||||
|
||||
desc "Import a given file into the database"
|
||||
desc 'Import a given file into the database'
|
||||
task :import, [:path] => :environment do |_t, args|
|
||||
dump_path = args.path
|
||||
connection_config = ActiveRecord::Base.connection_config
|
||||
|
||||
case connection_config[:adapter]
|
||||
when "postgresql"
|
||||
when 'postgresql'
|
||||
system("PGPASSWORD=#{connection_config[:password]} pg_restore " \
|
||||
"--verbose --clean --no-acl --no-owner " \
|
||||
'--verbose --clean --no-acl --no-owner ' \
|
||||
"--username=#{connection_config[:username]} " \
|
||||
"-d #{connection_config[:database]} #{dump_path}")
|
||||
when "mysql", "mysql2"
|
||||
when 'mysql', 'mysql2'
|
||||
system("mysql -u #{connection_config[:username]} " \
|
||||
"-p#{connection_config[:password]} " \
|
||||
"#{connection_config[:database]} < #{dump_path}")
|
||||
else
|
||||
raise NotImplementedError, "An importer hasn't been implemented for: " \
|
||||
"#{connection_config[:adapter]}"
|
||||
raise NotImplementedError.new("An importer hasn't been implemented for: " \
|
||||
"#{connection_config[:adapter]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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