Browse Source

Deschedule workshops when blocks are removed

development
Godwin 7 years ago
parent
commit
e57bfb28e4
  1. 2
      Gemfile
  2. 2
      app/controllers/application_controller.rb
  3. 7
      app/controllers/conference_administration_controller.rb
  4. 7
      app/controllers/conferences_controller.rb
  5. 2
      app/views/conferences/register.html.haml
  6. 1
      config/locales/en.yml
  7. 5
      config/routes.rb
  8. 12
      db/schema.rb

2
Gemfile

@ -43,7 +43,7 @@ gem 'redcarpet'
gem 'to_spreadsheet', git: 'https://github.com/glebm/to_spreadsheet.git'
group :development do
gem 'better_errors'
gem 'better_errors', '2.2.0'
gem 'binding_of_caller'
gem 'meta_request'

2
app/controllers/application_controller.rb

@ -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

7
app/controllers/conference_administration_controller.rb

@ -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

7
app/controllers/conferences_controller.rb

@ -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)

2
app/views/conferences/register.html.haml

@ -1,4 +1,4 @@
= render :partial => 'conferences/page_header', :locals => {:page_key => 'Conference_Registration'}
= render partial: 'conferences/page_header', locals: {page_key: 'Conference_Registration'}
- if @warnings.present?
= row class: 'warnings', tag: :ul do
- @warnings.each do |warning|

1
config/locales/en.yml

@ -1298,6 +1298,7 @@ en:
success:
messages:
admin:
block_deleted: Workshop block successfully removed
block_saved: Workshop block saved successfully
administrators: Organizations updated
dates: Conference dates updated successfully

5
config/routes.rb

@ -32,6 +32,11 @@ BikeBike::Application.routes.draw do
get 'check_in/:id' => 'conference_administration#check_in', as: :check_in, constraints: { id: /.+/ }
end
scope :survey do
root 'conferences#survey', as: :conference_survey
post 'save' => 'conferences#save_survey', as: :conference_survey_save
end
# Workshops
scope :workshops do
root 'workshops#workshops', as: :workshops

12
db/schema.rb

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170719024801) do
ActiveRecord::Schema.define(version: 20170817000540) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -110,6 +110,7 @@ ActiveRecord::Schema.define(version: 20170719024801) do
t.boolean "is_participant"
t.boolean "is_volunteer"
t.string "confirmation_token"
t.binary "data_old"
t.string "email"
t.boolean "complete"
t.boolean "completed"
@ -131,6 +132,7 @@ ActiveRecord::Schema.define(version: 20170719024801) do
t.json "housing_data"
t.integer "city_id"
t.json "data"
t.boolean "survey_taken"
end
create_table "conference_types", force: :cascade do |t|
@ -391,6 +393,14 @@ ActiveRecord::Schema.define(version: 20170719024801) do
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", unique: true, using: :btree
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
create_table "surveys", force: :cascade do |t|
t.string "name"
t.string "version"
t.json "results"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "translation_followers", force: :cascade do |t|
t.string "key"
t.integer "user_id"

Loading…
Cancel
Save