mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Fewer queries for for Conference#show
Reduces SQL wait times by >90% on splash pages.
This commit is contained in:
parent
29a640a267
commit
995176ffe5
11 changed files with 122 additions and 99 deletions
|
|
@ -33,6 +33,7 @@ class Conference < ApplicationRecord
|
|||
end
|
||||
has_many :resources, dependent: :destroy
|
||||
has_many :booths, dependent: :destroy
|
||||
has_many :confirmed_booths, -> { where(state: 'confirmed') }, class_name: 'Booth'
|
||||
|
||||
has_many :lodgings, dependent: :destroy
|
||||
has_many :registrations, dependent: :destroy
|
||||
|
|
@ -45,7 +46,16 @@ class Conference < ApplicationRecord
|
|||
has_many :campaigns, dependent: :destroy
|
||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
|
||||
has_one :call_for_sponsors, -> { where(cfp_type: 'sponsors') }, through: :program, source: :cfps
|
||||
has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps
|
||||
has_one :call_for_booths, -> { where(cfp_type: 'booths') }, through: :program, source: :cfps
|
||||
has_one :call_for_tracks, -> { where(cfp_type: 'tracks') }, through: :program, source: :cfps
|
||||
has_many :confirmed_tracks, -> { where(state: 'confirmed') }, through: :program, source: :tracks
|
||||
has_many :highlighted_events,
|
||||
-> { where(state: :confirmed, is_highlight: true) },
|
||||
through: :program,
|
||||
source: :events
|
||||
has_many :event_types, through: :program
|
||||
accepts_nested_attributes_for :venue
|
||||
accepts_nested_attributes_for :tickets, allow_destroy: true
|
||||
accepts_nested_attributes_for :sponsorship_levels, allow_destroy: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue