Deschedule workshops when blocks are removed

This commit is contained in:
Godwin
2017-08-19 08:35:18 -07:00
parent b26d601cf9
commit e57bfb28e4
8 changed files with 32 additions and 6 deletions
+1 -1
View File
@@ -423,7 +423,7 @@ class ApplicationController < BaseController
day_diff += 7 if day_diff < 0
day = (conference.start_date + day_diff.days).to_date
if @schedule[day].present? && @schedule[day][:times].present? && @schedule[day][:times][block['time'].to_f].present?
if block.present? && @schedule[day].present? && @schedule[day][:times].present? && @schedule[day][:times][block['time'].to_f].present?
@schedule[day][:times][block['time'].to_f][:item][:workshops][workshop.event_location_id] = { workshop: workshop, status: { errors: [], warnings: [], conflict_score: nil } }
@schedule[day][:locations][workshop.event_location_id] ||= workshop.event_location if workshop.event_location.present?
end
@@ -491,12 +491,12 @@ class ConferenceAdministrationController < ApplicationController
end
def administrate_locations
@locations = EventLocation.where(:conference_id => @this_conference.id)
@locations = EventLocation.where(conference_id: @this_conference.id)
end
def administrate_events
@event = Event.new(locale: I18n.locale)
@events = Event.where(:conference_id => @this_conference.id)
@events = Event.where(conference_id: @this_conference.id)
@day = nil
@time = nil
@length = 1.5
@@ -1409,6 +1409,7 @@ class ConferenceAdministrationController < ApplicationController
when 'delete'
location = EventLocation.find_by! id: params[:id].to_i, conference_id: @this_conference.id
location.destroy
@this_conference.validate_workshop_blocks
when 'create'
empty_param = get_empty(params, [:title, :address, :space])
if empty_param.present?
@@ -1506,11 +1507,13 @@ class ConferenceAdministrationController < ApplicationController
@this_conference.save
set_success_message :block_saved
end
@this_conference.validate_workshop_blocks
return false
when 'delete_block'
@this_conference.workshop_blocks ||= []
@this_conference.workshop_blocks.delete_at(params[:workshop_block].to_i)
@this_conference.save
@this_conference.validate_workshop_blocks
set_success_message :block_deleted
return false
end
@@ -109,6 +109,13 @@ class ConferencesController < ApplicationController
end
end
def survey
return do_404
# set_conference
# do_403 unless @this_conference.is_public || @this_conference.host?(current_user)
# do_403 if @this_conference.registration_open
end
helper_method :registration_complete?
def registration_steps(conference = nil)