From f5249be3d4c71dba1b33b06414cc274a0cda027d Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 5 Aug 2015 15:05:31 +0300 Subject: [PATCH] Management fixes --- .../layouts/management/_navigation.html.slim | 2 +- app/views/management/events/index.html.slim | 7 ++++++- ...0729135818_create_participation_records.rb | 5 ++++- spec/factories/personal_profile.rb | 21 ++++++++++--------- spec/factories/personal_profiles.rb | 15 ------------- 5 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 spec/factories/personal_profiles.rb diff --git a/app/views/layouts/management/_navigation.html.slim b/app/views/layouts/management/_navigation.html.slim index e4ee0cf..c471a2b 100644 --- a/app/views/layouts/management/_navigation.html.slim +++ b/app/views/layouts/management/_navigation.html.slim @@ -45,5 +45,5 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation" = link_to t("locales.#{locale}"), "?locale=#{locale}" - if user_signed_in? li - = link_to destroy_user_session_path, method: :delete do + = link_to destroy_management_user_session_path, method: :delete do = icon 'sign-out', t('sessions.sign_out') diff --git a/app/views/management/events/index.html.slim b/app/views/management/events/index.html.slim index c58d3a0..d86cb0b 100644 --- a/app/views/management/events/index.html.slim +++ b/app/views/management/events/index.html.slim @@ -22,7 +22,12 @@ tr td= event.title td= event.subtitle - td= link_to proposer_profile.name, [:management, @conference, proposer] + td + - if proposer_profile + = link_to proposer_profile.name, [:management, @conference, proposer_profile] + - else + | No profile for user #{proposer.email} + td #{event.length} minutes td= event.language diff --git a/db/migrate/20150729135818_create_participation_records.rb b/db/migrate/20150729135818_create_participation_records.rb index 33c395e..ca4f337 100644 --- a/db/migrate/20150729135818_create_participation_records.rb +++ b/db/migrate/20150729135818_create_participation_records.rb @@ -6,8 +6,11 @@ class CreateParticipationRecords < ActiveRecord::Migration event_to_speaker_profiles = execute 'SELECT * FROM events_speaker_profiles' event_to_speaker_profiles.each do |event_to_speaker_profile| + profile = PersonalProfile.find_by(id: event_to_speaker_profile['speaker_profile_id']) + next if not profile + Participation.create! event_id: event_to_speaker_profile['event_id'], - participant_id: PersonalProfile.find(event_to_speaker_profile['speaker_profile_id']).user_id, + participant_id: profile.user_id, approved: true end end diff --git a/spec/factories/personal_profile.rb b/spec/factories/personal_profile.rb index 081fddb..10b66e8 100644 --- a/spec/factories/personal_profile.rb +++ b/spec/factories/personal_profile.rb @@ -1,14 +1,15 @@ FactoryGirl.define do factory :personal_profile do - association :user - - first_name "Some" - last_name "Person" - picture File.open(Rails.root.join("spec/support/picture.jpg")) - mobile_phone "0883 123 456" - biography "Biography" - sequence(:public_email) { |n| "email#{n}@example.com" } - twitter "example" - github "example" + first_name 'Foo' + last_name 'Bar' + organisation 'foo inc.' + public_email 'foo@example.com' + picture { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'picture.jpg')) } + mobile_phone '+359883444555' + biography 'Just a bio' + github 'foobar' + twitter 'foobar' + user + conference end end diff --git a/spec/factories/personal_profiles.rb b/spec/factories/personal_profiles.rb deleted file mode 100644 index 10b66e8..0000000 --- a/spec/factories/personal_profiles.rb +++ /dev/null @@ -1,15 +0,0 @@ -FactoryGirl.define do - factory :personal_profile do - first_name 'Foo' - last_name 'Bar' - organisation 'foo inc.' - public_email 'foo@example.com' - picture { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'picture.jpg')) } - mobile_phone '+359883444555' - biography 'Just a bio' - github 'foobar' - twitter 'foobar' - user - conference - end -end