hackathon_manager 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 175ea3d064207e89723ec62b6728adc537d29f195c2dff8fa203042e2dfe32ea
4
- data.tar.gz: a32a72ffe843713f7313c8dec519e63114b74341c96863f924b6f1d8bbdce903
3
+ metadata.gz: 38ec6a89224e9425dbbf6a08e05dc282517ce6a9ecf6c5905967c7a71acbdd62
4
+ data.tar.gz: 461e4c1c853153cade1c635e92939e8f4207b06c13b39a5ba5559110d14beeb6
5
5
  SHA512:
6
- metadata.gz: 3f12381081f623c54fcb89ede14b0518b7bf5f1ff143587cd7bbfc95c57fab04e9541aedf62ffae3fd244cb1d24f6402a53a0d91ca4d1295c5606e6f8676f208
7
- data.tar.gz: 676fb9d13963f49b11b9b1015c387ace9176259149c03f2348fb76bf7112f239dcc0a29571492ab799ac5d0fd5268aa74ce11bd24c25345194977472d9af523b
6
+ metadata.gz: 787250f12418e9824e8a87ea77d026116623e4b1d56c5f1e1d00dbe2a43d94393adc48326e55590514ed7f08eb9fe0f4cf0e72277e8fc3085159b1f00b246633
7
+ data.tar.gz: a8572e718b57f1c3bc45b1854e9b6f9bf4a3b6c5b22b78c52069c0f277fd71e751fe7fb6386b7d4f92f459184eb0edc45c2e36e49597d536a8d587f78f078227
@@ -13,5 +13,7 @@
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
15
  //= require jquery.ui.autocomplete
16
+ //= require highcharts
17
+ //= require chartkick
16
18
  //= require_directory .
17
19
  //= require ./vendor/simplemde.min.js
@@ -149,7 +149,7 @@ class Manage::QuestionnairesController < Manage::ApplicationController
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
- :is_bus_captain
152
+ :bus_list_id, :is_bus_captain
153
153
  )
154
154
  end
155
155
 
@@ -22,12 +22,21 @@ class QuestionnaireDatatable < AjaxDatatablesRails::Base
22
22
 
23
23
  private
24
24
 
25
+ def note(record)
26
+ output = ''
27
+ output += '<i class="fa fa-exclamation-triangle icon-space-r"></i> <small>Minor</small>' if record.minor?
28
+ output += '<i class="fa fa-bus icon-space-r" title="Bus Captain"></i>' if record.bus_list_id?
29
+ output += '<small>Captain</small>' if record.is_bus_captain?
30
+ output = '<div class="center">' + output + '</div>' if output.present?
31
+ output.html_safe
32
+ end
33
+
25
34
  def data
26
35
  records.map do |record|
27
36
  {
28
37
  bulk: current_user.admin_limited_access ? '' : "<input type=\"checkbox\" data-bulk-row-edit=\"#{record.id}\">".html_safe,
29
38
  link: link_to('<i class="fa fa-search"></i>'.html_safe, manage_questionnaire_path(record)),
30
- note: record.minor? ? '<div class="center"><i class="fa fa-exclamation-triangle icon-space-r"></i> Minor</div>'.html_safe : '',
39
+ note: note(record),
31
40
  id: record.id,
32
41
  first_name: bold(record.first_name),
33
42
  last_name: bold(record.last_name),
@@ -1,9 +1,20 @@
1
- %p
2
- - accepted = Questionnaire.joins(:school).where("bus_list_id = '#{bus_list.id}' AND acc_status = 'accepted'").count
3
- = pluralize(accepted, 'person has', 'people have')
4
- been accepted but not yet RSVP'd.
1
+ - passengers = Questionnaire.joins(:school).group('schools.name').where(acc_status: 'rsvp_confirmed', bus_list_id: @bus_list.id).order("schools.name ASC").count
2
+ = pie_chart passengers
5
3
 
6
- %p
7
- - accepted = Questionnaire.joins(:school).where("bus_list_id = '#{bus_list.id}' AND acc_status = 'rsvp_confirmed'").count
8
- = pluralize(accepted, 'person has', 'people have')
9
- RSVP'd as attending but didn't sign up for the bus.
4
+ %br
5
+
6
+ :ruby
7
+ school_ids = Questionnaire.where(acc_status: 'rsvp_confirmed', bus_list_id: @bus_list.id).distinct.pluck(:school_id)
8
+ schools = Questionnaire.joins(:school).group('schools.name').where(school_id: school_ids, acc_status: 'rsvp_confirmed').order("schools.name ASC").count
9
+ schools_riding = Questionnaire.joins(:school).group('schools.name').where(school_id: school_ids, acc_status: 'rsvp_confirmed', bus_list_id: @bus_list.id).count
10
+ schools = schools.map do |name, count|
11
+ bus_count_row = schools_riding.select { |school_bus_name, _| school_bus_name == name }
12
+ bus_count = bus_count_row ? bus_count_row[name] || 0 : 0
13
+ count_without_bus = count - bus_count
14
+ [name, count_without_bus, bus_count]
15
+ end
16
+ data = [
17
+ { name: "Attending but not riding this bus", data: schools.sort_by { |_, no_bus, bus| [bus, no_bus] }.reverse },
18
+ { name: "Riding this bus", data: schools_riding }
19
+ ]
20
+ = bar_chart data, stacked: true, height: '400px'
@@ -15,10 +15,10 @@
15
15
  = render "layouts/hackathon_manager/header"
16
16
  = render "layouts/hackathon_manager/account_nav"
17
17
  = render "layouts/hackathon_manager/flashes"
18
+ = javascript_include_tag "hackathon_manager/application"
18
19
  #main
19
20
  %section.section
20
21
  .container
21
22
  = yield
22
23
  = render "layouts/hackathon_manager/footer"
23
- = javascript_include_tag "hackathon_manager/application"
24
24
  = render "layouts/hackathon_manager/shared_footer"
@@ -109,5 +109,8 @@
109
109
  - else
110
110
  = link_to "Make Bus Captain", toggle_bus_captain_manage_bus_list_path(@bus_list, questionnaire_id: p.id, bus_captain: '1'), method: 'post', data: { confirm: 'Are you sure? This will send a confirmation email to the bus captain.' }
111
111
 
112
- .alert.alert-info
113
- = render partial: 'bus_list_stats', locals: { bus_list: @bus_list }
112
+ .row.mt-2.mb-4
113
+ .col
114
+ %h4.border-bottom.pb-2.mb-4
115
+ Passenger Distribution
116
+ = render partial: 'bus_list_stats', locals: { bus_list: @bus_list }
@@ -48,7 +48,7 @@
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 :bus_list_id, label: "Bus list"
51
+ = f.association :bus_list, label: "Bus list", include_blank: 'Not travelling on a sponsored bus'
52
52
  = f.input :is_bus_captain, label: "Is Bus Captain"
53
53
 
54
54
  %hr
@@ -95,6 +95,20 @@
95
95
  = @questionnaire.special_needs
96
96
  - else
97
97
  %span.text-muted (none)
98
+ %dt.col-md-4 Bus list
99
+ %dd.col-md-8
100
+ - if @questionnaire.bus_list_id?
101
+ = link_to @questionnaire.bus_list.name, manage_bus_list_path(@questionnaire.bus_list_id)
102
+ - else
103
+ %span.text-muted (none)
104
+ %dt.col-md-4 Bus captain
105
+ %dd.col-md-8
106
+ - if @questionnaire.is_bus_captain?
107
+ %strong.text-danger Is bus captain
108
+ - elsif @questionnaire.bus_captain_interest?
109
+ %strong.text-success Interested in being a captain
110
+ - else
111
+ %span.text-muted No
98
112
  %dt.col-md-4 Traveling from
99
113
  %dd.col-md-8
100
114
  = @questionnaire.travel_not_from_school ? "Somewhere else (#{@questionnaire.travel_location})" : "<span class=\"text-muted\">My school</span>".html_safe
@@ -1,3 +1,3 @@
1
1
  module HackathonManager
2
- VERSION = '0.12.0'.freeze
2
+ VERSION = '0.12.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackathon_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Olivera