Browse Source

Fixed error loading select workshop table

development
Godwin 7 years ago
parent
commit
f6e71c0c8a
  1. 2
      app/controllers/conference_administration_controller.rb
  2. 12
      app/helpers/admin_helper.rb
  3. 4
      app/views/conference_administration/_select_workshop_table.html.haml

2
app/controllers/conference_administration_controller.rb

@ -1794,7 +1794,7 @@ class ConferenceAdministrationController < ApplicationController
@schedule[@day][@division][:times][@time] ||= {} @schedule[@day][@division][:times][@time] ||= {}
@schedule[@day][@division][:times][@time][:item] ||= {} @schedule[@day][@division][:times][@time][:item] ||= {}
@schedule[@day][@division][:times][@time][:item][:workshops] || {} @schedule[@day][@division][:times][@time][:item][:workshops] || {}
@invalid_locations = @schedule[@day][@division.to_i][:times][@time][:item][:workshops].keys @invalid_locations = @schedule[@day][@division][:times][@time][:item][:workshops].keys
@workshops.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |workshop| @workshops.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |workshop|
@ordered_workshops[workshop.id] = workshop @ordered_workshops[workshop.id] = workshop

12
app/helpers/admin_helper.rb

@ -130,7 +130,7 @@ module AdminHelper
return :bad_match return :bad_match
end end
def get_workshop_match(workshop, day, block, location) def get_workshop_match(workshop, day, division, time, block, location)
if workshop.event_location_id.present? && workshop.present? if workshop.event_location_id.present? && workshop.present?
if (Date.parse params[:day]).wday == workshop.block['day'] && block == workshop.block['block'].to_i if (Date.parse params[:day]).wday == workshop.block['day'] && block == workshop.block['block'].to_i
return :selected_space return :selected_space
@ -152,7 +152,15 @@ module AdminHelper
end end
end end
(((((@schedule[@day] || {})[:times] || {})[@time] || {})[:item] || {})[:workshops] || {}).each do |l, w| @schedule ||= {}
@schedule[day] ||= {}
@schedule[day][division] ||= []
@schedule[day][division][:times] ||= {}
@schedule[day][division][:times][time] ||= {}
@schedule[day][division][:times][time][:item] ||= {}
@schedule[day][division][:times][time][:item][:workshops] || {}
@schedule[day][division][:times][time][:item][:workshops].each do |l, w|
if w[:workshop].id != workshop.id if w[:workshop].id != workshop.id
f_a = w[:workshop].active_facilitators.map { | f | f.id } f_a = w[:workshop].active_facilitators.map { | f | f.id }
f_b = workshop.active_facilitators.map { | f | f.id } f_b = workshop.active_facilitators.map { | f | f.id }

4
app/views/conference_administration/_select_workshop_table.html.haml

@ -28,8 +28,8 @@
%th=_'articles.workshops.headings.facilitators' %th=_'articles.workshops.headings.facilitators'
%th=_'articles.workshops.headings.interested_count' %th=_'articles.workshops.headings.interested_count'
%th=_'articles.workshops.headings.notes' %th=_'articles.workshops.headings.notes'
- @ordered_workshops.each do | id, workshop | - @ordered_workshops.each do |id, workshop|
%tr.selectable{class: get_workshop_match(workshop, @day, @block, @event_location).to_s.gsub('_', '-'), data: {workshop: id}} %tr.selectable{ class: get_workshop_match(workshop, @day, @division, @time, @block, @event_location).to_s.gsub('_', '-'), data: { workshop: id } }
%th=workshop.title %th=workshop.title
%td=Workshop.all_themes.include?((workshop.theme || '').to_sym) ? (_"workshop.options.theme.#{workshop.theme}") : workshop.theme %td=Workshop.all_themes.include?((workshop.theme || '').to_sym) ? (_"workshop.options.theme.#{workshop.theme}") : workshop.theme
%td=workshop.space.present? ? (_"workshop.options.space.#{workshop.space}") : '' %td=workshop.space.present? ? (_"workshop.options.space.#{workshop.space}") : ''

Loading…
Cancel
Save