hackathon_manager 0.13.8 → 0.13.9

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: e19ab7e38fc596fcef9abf2ce3022aaf39bd89df79376781b37de78460032b82
4
- data.tar.gz: ba676426b9a47d85ea061072c8b11fa2626eb24feb281174beb4207b0776f570
3
+ metadata.gz: d2a08f6072d0cd24110a7713e93b2d51f638d6d5db69b4161a5ac3b435ff110a
4
+ data.tar.gz: dd293ca99e1691f209cc2805b16d4622eea6873fafeefba89b1037d0b8191898
5
5
  SHA512:
6
- metadata.gz: c69617993bdddbc4ea0976e4268adf0e7cd243d4b29fcd74bc167820c569540a99050c746edd2f83dfdc2c2eb2f309bd7499916326cde3708cdd1aaa60094bb5
7
- data.tar.gz: 86a66ad0595e7f8800032eef2f1d14f8daf8fad9891d5560ea246e03f1fac038927e26b6f87bebc504a534fc0ba749419a8b86a70604eda4a5970e5fe41a7c21
6
+ metadata.gz: 245becf5bdc9914218fcc6f20e4f00a19b6ff1dc5e4f66221e053d032070c8ac9917b64b929ebc32ff59516909d441ff6919bc5f8763981177f6ea7ef9970774
7
+ data.tar.gz: e376e3324f1ce9bf63a1706ef22f0f637a6252e42c9e96cb08b6a2e2135259a89815742116eccc44260140eafeee440dd44affbed1760aa466ac41be8df4bd47
@@ -10,7 +10,14 @@ class Manage::DashboardController < Manage::ApplicationController
10
10
  end
11
11
 
12
12
  def todays_activity_data
13
- render json: activity_chart_data(["Applications", "Confirmations", "Denials", "Non-Applied Users"], "hour", Time.zone.today.beginning_of_day..Time.zone.today.end_of_day)
13
+ where_filter = nil
14
+ types = ["Applications", "Confirmations", "Denials"]
15
+ if params[:school_id]
16
+ where_filter = { school_id: params[:school_id] }
17
+ else
18
+ types << "Non-Applied Users"
19
+ end
20
+ render json: activity_chart_data(types, "hour", Time.zone.today.beginning_of_day..Time.zone.today.end_of_day, where_filter)
14
21
  end
15
22
 
16
23
  def todays_stats_data
@@ -24,7 +31,11 @@ class Manage::DashboardController < Manage::ApplicationController
24
31
  end
25
32
 
26
33
  def confirmation_activity_data
27
- render json: activity_chart_data(["Confirmations", "Denials"], "day", 3.week.ago..Time.zone.now)
34
+ where_filter = nil
35
+ if params[:school_id]
36
+ where_filter = { school_id: params[:school_id] }
37
+ end
38
+ render json: activity_chart_data(["Confirmations", "Denials"], "day", 3.week.ago..Time.zone.now, where_filter)
28
39
  end
29
40
 
30
41
  def application_activity_data
@@ -95,24 +106,25 @@ class Manage::DashboardController < Manage::ApplicationController
95
106
 
96
107
  private
97
108
 
98
- def activity_chart_data(types, group_type, range)
109
+ def activity_chart_data(types, group_type, range, where_filter = nil)
99
110
  chart_data = []
100
111
  types.each do |type|
101
112
  case type
102
113
  when "Applications"
103
- data = Questionnaire.send("group_by_#{group_type}", :created_at, range: range).count
114
+ data = Questionnaire.send("group_by_#{group_type}", :created_at, range: range)
104
115
  when "RIT Applications"
105
- data = Questionnaire.where("school_id = \"2304\"").send("group_by_#{group_type}", :created_at, range: range).count
116
+ data = Questionnaire.where("school_id = \"2304\"").send("group_by_#{group_type}", :created_at, range: range)
106
117
  when "Non-RIT Applications"
107
- data = Questionnaire.where("school_id != \"2304\"").send("group_by_#{group_type}", :created_at, range: range).count
118
+ data = Questionnaire.where("school_id != \"2304\"").send("group_by_#{group_type}", :created_at, range: range)
108
119
  when "Confirmations"
109
- data = Questionnaire.where(acc_status: "rsvp_confirmed").send("group_by_#{group_type}", :acc_status_date, range: range).count
120
+ data = Questionnaire.where(acc_status: "rsvp_confirmed").send("group_by_#{group_type}", :acc_status_date, range: range)
110
121
  when "Denials"
111
- data = Questionnaire.where(acc_status: "rsvp_denied").send("group_by_#{group_type}", :acc_status_date, range: range).count
122
+ data = Questionnaire.where(acc_status: "rsvp_denied").send("group_by_#{group_type}", :acc_status_date, range: range)
112
123
  when "Non-Applied Users"
113
- data = User.without_questionnaire.send("group_by_#{group_type}", "users.created_at", range: range).count
124
+ data = User.without_questionnaire.send("group_by_#{group_type}", "users.created_at", range: range)
114
125
  end
115
- chart_data << { name: type, data: data }
126
+ data = data.where(where_filter) if where_filter && type != "Non-Applied Users"
127
+ chart_data << { name: type, data: data.count }
116
128
  end
117
129
  chart_data
118
130
  end
@@ -8,7 +8,7 @@ class Manage::TrackableTagsController < Manage::ApplicationController
8
8
 
9
9
  # GET /manage/trackable_tags
10
10
  def index
11
- @trackable_tags = TrackableTag.all
11
+ @trackable_tags = TrackableTag.all.order("name ASC")
12
12
  respond_with(:manage, @trackable_tags)
13
13
  end
14
14
 
@@ -22,7 +22,7 @@
22
22
  .col-7
23
23
  %h5.dashboard-container-title Today's Activity
24
24
  = area_chart todays_activity_data_manage_dashboard_index_path, colors: [blue, green, red, grey]
25
- .col
25
+ .col-5
26
26
  %h5.dashboard-container-title Today's Stats
27
27
  = pie_chart todays_stats_data_manage_dashboard_index_path, colors: [blue, green, red, grey]
28
28
 
@@ -1,3 +1,9 @@
1
+ - blue = "#4886C2"
2
+ - green = "#7FEC8D"
3
+ - red = "#E44646"
4
+ - orange = "#F49C54"
5
+ - grey = "#A6A6A6"
6
+
1
7
  = render "layouts/manage/page_title", title: @school.name, subtitle: "School" do
2
8
  .btn-group
3
9
  = link_to 'Edit', edit_manage_school_path(@school), class: 'btn btn-sm btn-outline-secondary'
@@ -56,9 +62,24 @@
56
62
  %span.fa.fa-info-circle.icon-space-l.icon-space-r-half
57
63
  If someone attempts to apply using a name above, they'll automatically be converted to this school.
58
64
 
65
+ .row.mt-2.mb-4
66
+ .col-7
67
+ %h4.border-bottom.pb-2.mb-4 Today's Activity
68
+ = area_chart todays_activity_data_manage_dashboard_index_path(school_id: @school.id), colors: [blue, green, red, grey]
69
+ .col-5
70
+ %h4.border-bottom.pb-2.mb-4 Total Distribution
71
+ = pie_chart @school.questionnaires.group('acc_status').count
72
+
73
+ .row.mt-2.mb-4
74
+ .col
75
+ %h4.border-bottom.pb-2.mb-4 Confirmation Activity
76
+ = area_chart confirmation_activity_data_manage_dashboard_index_path(school_id: @school.id), colors: [green, red], library: { legend: { enabled: false } }
77
+
59
78
  .row.mt-2
60
79
  .col
61
- %h4.pb-0 Questionnaires
80
+ %h4.pb-0
81
+ Questionnaires
82
+ %small.text-muted (#{@school.questionnaires.count} total)
62
83
  %table.table
63
84
  %caption #{@school.questionnaires.count} total
64
85
  %thead
@@ -1,3 +1,3 @@
1
1
  module HackathonManager
2
- VERSION = '0.13.8'.freeze
2
+ VERSION = '0.13.9'.freeze
3
3
  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.13.8
4
+ version: 0.13.9
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-02-15 00:00:00.000000000 Z
11
+ date: 2019-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails