diff --git a/app/controllers/admin/portal_controller.rb b/app/controllers/admin/portal_controller.rb index b3e63ccbc..5e7d3301e 100644 --- a/app/controllers/admin/portal_controller.rb +++ b/app/controllers/admin/portal_controller.rb @@ -4,9 +4,6 @@ def index @chapters = Chapter.active.all.order(name: :asc) @workshops = Workshop.upcoming - @groups = Group.joins(:chapter).merge(@chapters) - @subscribers = Subscription.kept.joins(:chapter).merge(@chapters) - .ordered.limit(20).includes(:member, :group) end def guide; end diff --git a/app/models/subscription.rb b/app/models/subscription.rb index fcbc2f5e3..d1914d696 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -10,7 +10,6 @@ class Subscription < ApplicationRecord # 'subscribed then unsubscribed' (issue #2920). The partial unique index # (index_subscriptions_on_member_id_group_id_active) enforces this at the DB level. validates :group, uniqueness: { scope: :member_id, conditions: -> { kept } } - scope :ordered, -> { order(created_at: :desc) } def student? group.name.casecmp('students').zero? diff --git a/app/views/admin/portal/index.html.haml b/app/views/admin/portal/index.html.haml index 25ec1dcbd..bf00dceb0 100644 --- a/app/views/admin/portal/index.html.haml +++ b/app/views/admin/portal/index.html.haml @@ -22,17 +22,3 @@ = link_to 'Members Directory', admin_members_path, class: 'btn btn-primary btn-lg mb-3' = link_to 'Chapter Status', status_admin_chapters_path, class: 'btn btn-primary btn-lg mb-3' = link_to 'Stats', admin_stats_path, class: 'btn btn-primary btn-lg mb-3' - %hr - - .row - .col-12.col-md-3 - %h3.mb-3 Groups - %ul.list-unstyled.m-0 - - @groups.each do |group| - %li.border-bottom.border-dark.pb-2.mb-3 - = link_to [:admin, group] do - #{group.name} (#{group.chapter.name}) - - .col-12.col-md-9 - %h3.mb-3 Latest Subscribers - = render partial: 'admin/subscriptions/index', locals: { subscribers: @subscribers } diff --git a/spec/features/admin/accessing_portal_spec.rb b/spec/features/admin/accessing_portal_spec.rb index 5a2cf54a5..2fbecf441 100644 --- a/spec/features/admin/accessing_portal_spec.rb +++ b/spec/features/admin/accessing_portal_spec.rb @@ -17,17 +17,12 @@ end scenario 'can view all active chapters listed' do - chapter = Fabricate(:chapter_with_groups) - inactive_chapter = Fabricate(:chapter_with_groups, active: false) + chapter = Fabricate(:chapter, name: 'Manchester') + inactive_chapter = Fabricate(:chapter, name: 'Dormant', active: false) visit admin_root_path - chapter.groups.each do |group| - expect(page).to have_text(group.to_s) - end - - inactive_chapter.groups.each do |group| - expect(page).to have_no_text(group.to_s) - end + expect(page).to have_text(chapter.name) + expect(page).to have_no_text(inactive_chapter.name) end scenario 'can access sponsor contacts' do