hackathon_manager 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hackathon_manager/manage/lib/setupDataTables.js +1 -2
- data/app/assets/stylesheets/hackathon_manager/forms/_forms.sass +3 -0
- data/app/controllers/bus_lists_controller.rb +1 -1
- data/app/controllers/manage/bus_lists_controller.rb +2 -3
- data/app/controllers/manage/dashboard_controller.rb +1 -1
- data/app/controllers/manage/questionnaires_controller.rb +1 -1
- data/app/controllers/manage/schools_controller.rb +1 -1
- data/app/controllers/questionnaires_controller.rb +1 -1
- data/app/controllers/rsvps_controller.rb +10 -10
- data/app/datatables/school_datatable.rb +2 -3
- data/app/models/bus_list.rb +6 -2
- data/app/models/message.rb +1 -3
- data/app/models/message_recipient_query.rb +1 -5
- data/app/models/questionnaire.rb +1 -9
- data/app/models/school.rb +0 -6
- data/app/views/application/_bus_list_stats.html.haml +2 -2
- data/app/views/layouts/hackathon_manager/_account_nav.html.haml +1 -1
- data/app/views/manage/bus_lists/show.html.haml +1 -1
- data/app/views/manage/questionnaires/_form.html.haml +2 -4
- data/app/views/manage/schools/_form.html.haml +0 -1
- data/app/views/manage/schools/index.html.haml +0 -1
- data/app/views/manage/schools/show.html.haml +0 -2
- data/app/views/rsvps/show.html.haml +57 -50
- data/app/workers/bulk_message_worker.rb +0 -4
- data/db/migrate/20190113231044_refactor_bus_lists.rb +35 -0
- data/lib/hackathon_manager/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 175ea3d064207e89723ec62b6728adc537d29f195c2dff8fa203042e2dfe32ea
|
4
|
+
data.tar.gz: a32a72ffe843713f7313c8dec519e63114b74341c96863f924b6f1d8bbdce903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f12381081f623c54fcb89ede14b0518b7bf5f1ff143587cd7bbfc95c57fab04e9541aedf62ffae3fd244cb1d24f6402a53a0d91ca4d1295c5606e6f8676f208
|
7
|
+
data.tar.gz: 676fb9d13963f49b11b9b1015c387ace9176259149c03f2348fb76bf7112f239dcc0a29571492ab799ac5d0fd5268aa74ce11bd24c25345194977472d9af523b
|
@@ -51,8 +51,7 @@ var setupDataTables = function() {
|
|
51
51
|
{ orderable: true, data: 'name' },
|
52
52
|
{ orderable: true, data: 'city' },
|
53
53
|
{ orderable: true, data: 'state' },
|
54
|
-
{ orderable: true, data: 'questionnaire_count' }
|
55
|
-
{ orderable: false, data: 'bus_list' }
|
54
|
+
{ orderable: true, data: 'questionnaire_count' }
|
56
55
|
]
|
57
56
|
});
|
58
57
|
|
@@ -20,7 +20,7 @@ class BusListsController < ApplicationController
|
|
20
20
|
boarded_bus = params[:questionnaire][:boarded_bus].to_s
|
21
21
|
questionnaire = Questionnaire.find_by_id(params[:questionnaire][:id])
|
22
22
|
|
23
|
-
if !['true', 'false'].include?(boarded_bus) || questionnaire.blank?
|
23
|
+
if !['true', 'false'].include?(boarded_bus) || questionnaire.blank?
|
24
24
|
head :bad_request
|
25
25
|
return
|
26
26
|
end
|
@@ -32,9 +32,8 @@ class Manage::BusListsController < Manage::ApplicationController
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def destroy
|
35
|
-
|
36
|
-
|
37
|
-
school.update_attribute(:bus_list_id, nil)
|
35
|
+
Questionnaire.where(bus_list_id: @bus_list.id).each do |questionnaire|
|
36
|
+
questionnaire.update_attribute(:bus_list_id, nil)
|
38
37
|
end
|
39
38
|
@bus_list.destroy
|
40
39
|
respond_with(:manage, @bus_list)
|
@@ -46,7 +46,7 @@ class Manage::DashboardController < Manage::ApplicationController
|
|
46
46
|
|
47
47
|
def schools_confirmed_data
|
48
48
|
schools = Questionnaire.joins(:school).group('schools.name').where("acc_status = 'rsvp_confirmed'").order("schools.name ASC").count
|
49
|
-
schools_riding = Questionnaire.joins(:school).group('schools.name').where("acc_status = 'rsvp_confirmed' AND
|
49
|
+
schools_riding = Questionnaire.joins(:school).group('schools.name').where("acc_status = 'rsvp_confirmed' AND bus_list_id").count
|
50
50
|
schools = schools.map do |name, count|
|
51
51
|
bus_count_row = schools_riding.select { |school_bus_name, _| school_bus_name == name }
|
52
52
|
bus_count = bus_count_row ? bus_count_row[name] || 0 : 0
|
@@ -146,7 +146,7 @@ class Manage::QuestionnairesController < Manage::ApplicationController
|
|
146
146
|
:date_of_birth, :interest, :school_id, :school_name, :major, :level_of_study,
|
147
147
|
:shirt_size, :dietary_restrictions, :special_needs, :international,
|
148
148
|
:portfolio_url, :vcs_url, :agreement_accepted, :bus_captain_interest,
|
149
|
-
:
|
149
|
+
:phone, :can_share_info, :code_of_conduct_accepted,
|
150
150
|
:travel_not_from_school, :travel_location, :data_sharing_accepted,
|
151
151
|
:graduation_year, :race_ethnicity, :resume, :delete_resume, :why_attend,
|
152
152
|
:is_bus_captain
|
@@ -125,7 +125,7 @@ class QuestionnairesController < ApplicationController
|
|
125
125
|
:date_of_birth, :interest, :school_id, :school_name, :major, :level_of_study,
|
126
126
|
:shirt_size, :dietary_restrictions, :special_needs, :international,
|
127
127
|
:portfolio_url, :vcs_url, :agreement_accepted, :bus_captain_interest,
|
128
|
-
:
|
128
|
+
:phone, :can_share_info, :code_of_conduct_accepted,
|
129
129
|
:travel_not_from_school, :travel_location, :data_sharing_accepted,
|
130
130
|
:graduation_year, :race_ethnicity, :resume, :delete_resume, :why_attend
|
131
131
|
)
|
@@ -20,8 +20,8 @@ class RsvpsController < ApplicationController
|
|
20
20
|
@questionnaire.acc_status_author_id = current_user.id
|
21
21
|
@questionnaire.acc_status_date = Time.now
|
22
22
|
if @questionnaire.save
|
23
|
-
flash[:notice] = "Thank you for confirming your attendance! "
|
24
|
-
flash[:notice] +=
|
23
|
+
flash[:notice] = "Thank you for confirming your attendance! You're all set to attend."
|
24
|
+
flash[:notice] += " See below for additional bus information." if BusList.any?
|
25
25
|
else
|
26
26
|
flash[:notice] = rsvp_error_notice
|
27
27
|
end
|
@@ -59,15 +59,14 @@ class RsvpsController < ApplicationController
|
|
59
59
|
@questionnaire.acc_status_date = Time.now if @questionnaire.acc_status != params[:questionnaire][:acc_status]
|
60
60
|
@questionnaire.acc_status = params[:questionnaire][:acc_status]
|
61
61
|
@questionnaire.acc_status_author_id = current_user.id
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
@questionnaire.bus_captain_interest = false
|
62
|
+
|
63
|
+
bus_list_id = params[:questionnaire][:bus_list_id].presence
|
64
|
+
is_joining_bus = !@questionnaire.bus_list_id && bus_list_id
|
65
|
+
bus_list = bus_list_id && BusList.find(bus_list_id)
|
66
|
+
if is_joining_bus && bus_list.full?
|
67
|
+
flash[:notice] = "Sorry, that bus is full! You may need to arrange other plans for transportation."
|
69
68
|
else
|
70
|
-
@questionnaire.
|
69
|
+
@questionnaire.bus_list_id = bus_list_id
|
71
70
|
@questionnaire.bus_captain_interest = params[:questionnaire][:bus_captain_interest]
|
72
71
|
end
|
73
72
|
|
@@ -78,6 +77,7 @@ class RsvpsController < ApplicationController
|
|
78
77
|
end
|
79
78
|
|
80
79
|
flash[:notice] = "Your RSVP has been updated." if flash[:notice].blank?
|
80
|
+
flash[:notice] += " See below for additional bus information!" if @questionnaire.bus_list_id?
|
81
81
|
|
82
82
|
redirect_to rsvp_path
|
83
83
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class SchoolDatatable < AjaxDatatablesRails::Base
|
2
|
-
def_delegators :@view, :link_to, :manage_school_path, :
|
2
|
+
def_delegators :@view, :link_to, :manage_school_path, :bold
|
3
3
|
|
4
4
|
def view_columns
|
5
5
|
@view_columns ||= {
|
@@ -20,8 +20,7 @@ class SchoolDatatable < AjaxDatatablesRails::Base
|
|
20
20
|
name: link_to(bold(record.name), manage_school_path(record)),
|
21
21
|
city: record.city,
|
22
22
|
state: record.state,
|
23
|
-
questionnaire_count: record.questionnaire_count
|
24
|
-
bus_list: record.bus_list ? link_to(record.bus_list.name, manage_bus_list_path(record.bus_list)) : ''
|
23
|
+
questionnaire_count: record.questionnaire_count
|
25
24
|
}
|
26
25
|
end
|
27
26
|
end
|
data/app/models/bus_list.rb
CHANGED
@@ -2,7 +2,7 @@ class BusList < ApplicationRecord
|
|
2
2
|
validates_presence_of :name, :capacity
|
3
3
|
validates_uniqueness_of :name
|
4
4
|
|
5
|
-
has_many :
|
5
|
+
has_many :questionnaires
|
6
6
|
|
7
7
|
strip_attributes
|
8
8
|
|
@@ -11,7 +11,11 @@ class BusList < ApplicationRecord
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def passengers
|
14
|
-
|
14
|
+
questionnaires.where("acc_status = 'rsvp_confirmed'").order("last_name ASC")
|
15
|
+
end
|
16
|
+
|
17
|
+
def schools
|
18
|
+
passengers.joins(:school).map(&:school).uniq
|
15
19
|
end
|
16
20
|
|
17
21
|
def checked_in_passengers
|
data/app/models/message.rb
CHANGED
@@ -103,9 +103,7 @@ class Message < ApplicationRecord
|
|
103
103
|
option = ->(query, model) { [MessageRecipientQuery.friendly_name(query, model), query] }
|
104
104
|
bus_list_recipients = BusList.select(:id, :name).map do |bus_list|
|
105
105
|
[
|
106
|
-
option.call("bus-list::#{bus_list.id}", bus_list)
|
107
|
-
option.call("bus-list--eligible::#{bus_list.id}", bus_list),
|
108
|
-
option.call("bus-list--applied::#{bus_list.id}", bus_list)
|
106
|
+
option.call("bus-list::#{bus_list.id}", bus_list)
|
109
107
|
]
|
110
108
|
end
|
111
109
|
bus_list_recipients.flatten!(1) # Required since we have multiple options for each bus list
|
@@ -25,7 +25,7 @@ class MessageRecipientQuery
|
|
25
25
|
# Find the backing database model, ensuring the given ID exists for that model.
|
26
26
|
model_name = nil
|
27
27
|
case type
|
28
|
-
when "bus-list"
|
28
|
+
when "bus-list"
|
29
29
|
model ||= BusList.find_by_id(id)
|
30
30
|
model_name = "Bus List"
|
31
31
|
when "school"
|
@@ -58,10 +58,6 @@ class MessageRecipientQuery
|
|
58
58
|
case recipient_query.type
|
59
59
|
when "bus-list"
|
60
60
|
"Bus List: #{model.name} (signed up passengers)"
|
61
|
-
when "bus-list--eligible"
|
62
|
-
"Bus List: #{model.name} (eligible, not signed up for bus)"
|
63
|
-
when "bus-list--applied"
|
64
|
-
"Bus List: #{model.name} (applied/not yet accepted)"
|
65
61
|
when "school"
|
66
62
|
"Confirmed or Accepted: #{model.name}"
|
67
63
|
when "blazer"
|
data/app/models/questionnaire.rb
CHANGED
@@ -28,6 +28,7 @@ class Questionnaire < ApplicationRecord
|
|
28
28
|
validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub or BitBucket url"
|
29
29
|
|
30
30
|
belongs_to :school
|
31
|
+
belongs_to :bus_list, optional: true
|
31
32
|
|
32
33
|
strip_attributes
|
33
34
|
|
@@ -183,15 +184,6 @@ class Questionnaire < ApplicationRecord
|
|
183
184
|
['rsvp_confirmed', 'rsvp_denied'].include? acc_status
|
184
185
|
end
|
185
186
|
|
186
|
-
def eligible_for_a_bus?
|
187
|
-
school.present? && school.bus_list_id?
|
188
|
-
end
|
189
|
-
|
190
|
-
def bus_list
|
191
|
-
return unless eligible_for_a_bus?
|
192
|
-
school.bus_list
|
193
|
-
end
|
194
|
-
|
195
187
|
def message_events
|
196
188
|
return [] unless ENV['SPARKPOST_API_KEY']
|
197
189
|
|
data/app/models/school.rb
CHANGED
@@ -6,7 +6,6 @@ class School < ApplicationRecord
|
|
6
6
|
strip_attributes
|
7
7
|
|
8
8
|
has_many :questionnaires
|
9
|
-
belongs_to :bus_list, optional: true
|
10
9
|
|
11
10
|
def full_name
|
12
11
|
out = ""
|
@@ -26,11 +25,6 @@ class School < ApplicationRecord
|
|
26
25
|
out
|
27
26
|
end
|
28
27
|
|
29
|
-
def bus_list
|
30
|
-
return unless bus_list_id
|
31
|
-
BusList.find(bus_list_id)
|
32
|
-
end
|
33
|
-
|
34
28
|
def fips_code
|
35
29
|
Fips.where(city: city, state: state).first
|
36
30
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
%p
|
2
|
-
- accepted = Questionnaire.joins(:school).where("
|
2
|
+
- accepted = Questionnaire.joins(:school).where("bus_list_id = '#{bus_list.id}' AND acc_status = 'accepted'").count
|
3
3
|
= pluralize(accepted, 'person has', 'people have')
|
4
4
|
been accepted but not yet RSVP'd.
|
5
5
|
|
6
6
|
%p
|
7
|
-
- accepted = Questionnaire.joins(:school).where("
|
7
|
+
- accepted = Questionnaire.joins(:school).where("bus_list_id = '#{bus_list.id}' AND acc_status = 'rsvp_confirmed'").count
|
8
8
|
= pluralize(accepted, 'person has', 'people have')
|
9
9
|
RSVP'd as attending but didn't sign up for the bus.
|
@@ -6,5 +6,5 @@
|
|
6
6
|
- if current_user.questionnaire.present? && current_user.questionnaire.can_rsvp?
|
7
7
|
= active_link_to 'RSVP', rsvp_path, class: 'account-nav__link', active_class: 'account-nav__link--active'
|
8
8
|
= active_link_to 'Application', questionnaires_path, class: 'account-nav__link', active_class: 'account-nav__link--active'
|
9
|
-
- if current_user.questionnaire.present? && current_user.questionnaire.
|
9
|
+
- if current_user.questionnaire.present? && current_user.questionnaire.bus_list_id && current_user.questionnaire.is_bus_captain?
|
10
10
|
= active_link_to 'Bus Captain'.html_safe, bus_list_path, class: 'account-nav__link', active_class: 'account-nav__link--active'
|
@@ -30,7 +30,7 @@
|
|
30
30
|
%br
|
31
31
|
%small.text-muted
|
32
32
|
- accepted = school.questionnaires.where(acc_status: 'accepted').count
|
33
|
-
- no_bus = school.questionnaires.where(acc_status: 'rsvp_confirmed',
|
33
|
+
- no_bus = school.questionnaires.where(acc_status: 'rsvp_confirmed', bus_list_id: nil).count
|
34
34
|
#{accepted} yet to RSVP, #{no_bus} attending but not using bus
|
35
35
|
|
36
36
|
.col-lg-6
|
@@ -48,10 +48,8 @@
|
|
48
48
|
= f.input :travel_not_from_school, label: "I will not be traveling from my school"
|
49
49
|
= f.input :travel_location, input_html: { "data-validate" => "presence", disabled: !travel_state }, wrapper_html: { style: travel_state ? "" : "display: none" }, label: "Travel Location"
|
50
50
|
|
51
|
-
= f.input :
|
52
|
-
= f.input :is_bus_captain, label: "Is Bus Captain"
|
53
|
-
- if !@questionnaire.eligible_for_a_bus?
|
54
|
-
%p (school not eligible for bus)
|
51
|
+
= f.input :bus_list_id, label: "Bus list"
|
52
|
+
= f.input :is_bus_captain, label: "Is Bus Captain"
|
55
53
|
|
56
54
|
%hr
|
57
55
|
|
@@ -34,8 +34,6 @@
|
|
34
34
|
= link_to link, target: '_blank' do
|
35
35
|
Search in Google Maps
|
36
36
|
%span.fa.fa-external-link.icon-space-l-half
|
37
|
-
%dt.col-md-4 Bus List
|
38
|
-
%dd.col-md-8= @school.bus_list ? link_to(@school.bus_list.name, manage_bus_list_path(@school.bus_list)) : '(not assigned)'
|
39
37
|
|
40
38
|
.col-md-6
|
41
39
|
%h4.pb-0 Duplicate Names
|
@@ -1,65 +1,72 @@
|
|
1
1
|
- title "RSVP"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
= simple_form_for @questionnaire, url: url_for(controller: "rsvps", action: "update"), html: { "data-validate" => "form" } do |f|
|
3
|
+
.form-container
|
4
|
+
#disclaimer
|
5
|
+
%h1.section-title
|
6
|
+
RSVP
|
7
|
+
%span.emphasized Preferences
|
8
|
+
- if @questionnaire.acc_status == "rsvp_confirmed" || @questionnaire.checked_in?
|
9
|
+
%strong ALL SET TO ATTEND!
|
10
|
+
- if Rails.configuration.hackathon['thanks_for_rsvp']
|
11
|
+
%br
|
12
|
+
= markdown(Rails.configuration.hackathon['thanks_for_rsvp'])
|
11
13
|
- else
|
12
|
-
|
13
|
-
|
14
|
-
%br
|
15
|
-
= markdown(Rails.configuration.hackathon['thanks_for_rsvp'])
|
16
|
-
- else
|
17
|
-
%strong= current_user.questionnaire.verbal_status.upcase
|
18
|
-
- if @questionnaire.acc_status == "rsvp_denied"
|
19
|
-
%p Sorry to hear you won't be with us this year.
|
14
|
+
%br
|
15
|
+
%br
|
20
16
|
- else
|
21
|
-
%
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
%strong= current_user.questionnaire.verbal_status.upcase
|
18
|
+
- if @questionnaire.acc_status == "rsvp_denied"
|
19
|
+
%p Sorry to hear you won't be with us this year.
|
20
|
+
- else
|
21
|
+
%p You've been accepted to #{Rails.configuration.hackathon['name']}!
|
22
|
+
%p Will you be attending?
|
25
23
|
|
26
|
-
= simple_form_for @questionnaire, url: url_for(controller: "rsvps", action: "update"), html: { "data-validate" => "form" } do |f|
|
27
24
|
.form-inputs
|
28
25
|
= f.input :acc_status, as: :radio_buttons, collection: { " Attending!" => "rsvp_confirmed", " Not Attending." => "rsvp_denied" }, label: "Attendance:", required: true
|
29
26
|
|
30
27
|
.hide-if-not-attending{ style: @questionnaire.acc_status == "rsvp_denied" ? "display: none;" : "" }
|
31
28
|
= f.input :phone, input_html: { "data-validate" => "presence" }, label: "Please verify your phone number:"
|
32
29
|
|
33
|
-
|
34
|
-
- if @questionnaire.eligible_for_a_bus?
|
35
|
-
- if !@questionnaire.riding_bus && @questionnaire.bus_list.full?
|
36
|
-
#disclaimer
|
37
|
-
Aw, shucks. Your school is eligible for a bus, but all the seats are currently taken.
|
38
|
-
- else
|
39
|
-
%p
|
40
|
-
- if @questionnaire.riding_bus && @questionnaire.acc_status != "rsvp_denied"
|
41
|
-
.fa.fa-check
|
42
|
-
You're all set to ride the bus.
|
43
|
-
- if @questionnaire.bus_list.full?
|
44
|
-
%br
|
45
|
-
%br
|
46
|
-
.fa.fa-warning
|
47
|
-
Your bus is currently full. If you are no longer riding, please update your status so someone else may use it.
|
48
|
-
- else
|
49
|
-
Good news: your school is eligible for a bus! Will you be riding?
|
50
|
-
.form-inputs
|
51
|
-
= f.input :riding_bus, as: :radio_buttons, collection: { " Yes!" => true, " No thank you." => false }, label: "Riding the bus:", hint: "You MUST sign up here if you wish to ride the bus! IDs will be checked at boarding."
|
52
|
-
- if @questionnaire.bus_list.needs_bus_captain
|
53
|
-
= f.input :bus_captain_interest, as: :radio_buttons, collection: { " Yes!" => true, " No thank you." => false }, label: "We're also looking for bus captains from your school. Are you interested?"
|
30
|
+
= f.button :submit, value: "Update"
|
54
31
|
|
55
|
-
|
56
|
-
|
32
|
+
- if BusList.any?
|
33
|
+
.form-container.hide-if-not-attending{ style: @questionnaire.acc_status == "rsvp_denied" ? "display: none;" : "" }
|
34
|
+
#disclaimer
|
35
|
+
%h1.section-title
|
36
|
+
Bus
|
37
|
+
%span.emphasized Sign-up
|
38
|
+
- if @questionnaire.acc_status == "rsvp_confirmed" || @questionnaire.checked_in?
|
39
|
+
%strong
|
40
|
+
- if @questionnaire.bus_list_id
|
41
|
+
ALL SET TO RIDE THE BUS!
|
42
|
+
- else
|
43
|
+
NOT RIDING BUS
|
44
|
+
|
45
|
+
%br
|
46
|
+
%br
|
47
|
+
|
48
|
+
%p
|
49
|
+
We are providing free, sponsored busses. Will you be riding?
|
50
|
+
%br
|
51
|
+
%em
|
52
|
+
%strong You must sign up here if you want to ride.
|
53
|
+
|
54
|
+
.form-inputs
|
55
|
+
- bus_list_options = ([OpenStruct.new({ name: 'Not riding a sponsored bus', id: '' })] + BusList.all.to_a)
|
56
|
+
= f.association :bus_list, as: :radio_buttons, collection: bus_list_options, label_method: :name, value_method: :id, label: false, wrapper_html: { class: 'radio_buttons_vertical' }
|
57
|
+
- if BusList.where(needs_bus_captain: true).any?
|
58
|
+
= f.input :bus_captain_interest, as: :radio_buttons, collection: { " Yes!" => true, " No thank you." => false }, label: "Would you be interested in being a bus captain?"
|
59
|
+
%p
|
60
|
+
%small Busses will pick up the morning of, arriving in time for opening ceremony. They will depart shortly after closing ceremony, dropping off to the same pick-up locations.
|
61
|
+
%p
|
62
|
+
%small If you sign up for a bus not stopping at your school, you are responsible for transportation to & from a pick-up location.
|
57
63
|
|
58
|
-
.right
|
59
64
|
= f.button :submit, value: "Update"
|
60
65
|
%br
|
61
|
-
- if @questionnaire.
|
62
|
-
%p= link_to "
|
66
|
+
- if @questionnaire.bus_list_id && @questionnaire.is_bus_captain?
|
67
|
+
%p= link_to "Bus Captain Dashboard »".html_safe, bus_list_path
|
63
68
|
|
64
|
-
|
65
|
-
|
69
|
+
- if @questionnaire.bus_list_id
|
70
|
+
= render partial: 'bus_list_info', locals: { bus_list: @questionnaire.bus_list }
|
71
|
+
- else
|
72
|
+
= f.input :bus_list_id, as: :hidden, value: ''
|
@@ -68,10 +68,6 @@ class BulkMessageWorker
|
|
68
68
|
case recipient_query.type
|
69
69
|
when "bus-list"
|
70
70
|
model.passengers.pluck(:user_id)
|
71
|
-
when "bus-list--eligible"
|
72
|
-
Questionnaire.joins(:school).where("schools.bus_list_id = ? AND riding_bus != 1 AND (acc_status = 'accepted' OR acc_status = 'rsvp_confirmed')", model.id).pluck(:user_id)
|
73
|
-
when "bus-list--applied"
|
74
|
-
Questionnaire.joins(:school).where("schools.bus_list_id = ? AND (acc_status != 'accepted' AND acc_status != 'rsvp_confirmed' AND acc_status != 'rsvp_denied')", model.id).pluck(:user_id)
|
75
71
|
when "school"
|
76
72
|
Questionnaire.where("school_id = ? AND (acc_status = 'rsvp_confirmed' OR acc_status = 'accepted')", model.id).pluck(:user_id)
|
77
73
|
when "blazer"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class RefactorBusLists < ActiveRecord::Migration[5.2]
|
2
|
+
def up
|
3
|
+
make_new_change
|
4
|
+
BusList.all.each do |bus_list|
|
5
|
+
Questionnaire.joins(
|
6
|
+
:school
|
7
|
+
).where(
|
8
|
+
"schools.bus_list_id = ? AND riding_bus = 1 AND (acc_status = 'accepted' OR acc_status = 'rsvp_confirmed')", bus_list.id
|
9
|
+
).all.each do |q|
|
10
|
+
q.update_attribute(:bus_list_id, bus_list.id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
cleanup_old
|
14
|
+
end
|
15
|
+
|
16
|
+
def down
|
17
|
+
revert { cleanup_old }
|
18
|
+
BusList.all.each do |bus_list|
|
19
|
+
bus_list.passengers.each do |passengers|
|
20
|
+
passengers.update_attribute(:riding_bus, true)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
revert { make_new_change }
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def make_new_change
|
29
|
+
add_reference :questionnaires, :bus_list, type: :integer, foreign_key: true
|
30
|
+
end
|
31
|
+
|
32
|
+
def cleanup_old
|
33
|
+
remove_column :schools, :bus_list_id
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hackathon_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Olivera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -706,6 +706,7 @@ files:
|
|
706
706
|
- db/migrate/20181221195241_enable_pkce.rb
|
707
707
|
- db/migrate/20190107232955_create_trackable_tags.rb
|
708
708
|
- db/migrate/20190107233210_create_trackable_events.rb
|
709
|
+
- db/migrate/20190113231044_refactor_bus_lists.rb
|
709
710
|
- db/schools.csv
|
710
711
|
- db/seed_messages/questionnaire--accepted.md
|
711
712
|
- db/seed_messages/questionnaire--denied.md
|