mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Autocorrect new rubocop offenses
This commit is contained in:
parent
deda3d4273
commit
988b3bf689
24 changed files with 48 additions and 41 deletions
|
|
@ -5,6 +5,7 @@ namespace :data do
|
|||
|
||||
task demo: :environment do
|
||||
include FactoryBot::Syntax::Methods
|
||||
|
||||
conference = create(:full_conference, title: 'Open Source Event Manager Demo', short_title: 'osemdemo' ,description: "This is a [Open Source Event Manager](http://osem.io/) demo instance. You can log in as **admin** with the password **password123** or just you just [sign up](/accounts/sign_up) with your own user. We hope you enjoy checking out all the functionality, if you have questions don't hesitate to [contact us](http://osem.io/#contact)!\r\n\r\n## Data will be destroyed every thirty minutes or whenever someone updates the [OSEM source code on github](https://github.com/openSUSE/osem/commits/master).")
|
||||
conference.contact.update(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io')
|
||||
create(:admin, email: 'admin@osem.io', username: 'admin', password: 'password123', password_confirmation: 'password123')
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ namespace :events_registrations do
|
|||
duplicates = EventsRegistration.all.map { |er| er.id if er.valid? == false}.compact
|
||||
|
||||
puts "Duplicates found: #{duplicates.count}"
|
||||
if duplicates.count > 0
|
||||
if duplicates.any?
|
||||
puts "With IDs: #{duplicates}"
|
||||
end
|
||||
|
||||
EventsRegistration.all.each do |er|
|
||||
records = EventsRegistration.where(registration_id: er.registration_id, event_id: er.event_id)
|
||||
if records.count > 1
|
||||
if records.many?
|
||||
# Iterate through duplicates (excluding 1st record)
|
||||
(1..(records.count - 1)).each do |i|
|
||||
puts "Deleting EventsRegistration record with ID #{records[i].id} ..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue