Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the events_signup routing, controller, and view. #15095

Merged
merged 1 commit into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 0 additions & 53 deletions dashboard/app/controllers/admin_hoc_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,6 @@ class AdminHocController < ApplicationController
before_action :require_admin
check_authorization

def event_signups
# A hash from HOC year to HOC data.
event_signup_data = {2014 => nil, 2015 => nil, 2016 => nil}
SeamlessDatabasePool.use_persistent_read_connection do
# Get the HOC signup counts by day, deduped by email and name. We restrict
# to August through December to avoid long trails of (inappropriate?)
# signups.
event_signup_data.keys.each do |year|
event_signup_data[year] = DB[:forms].
where(
'kind = ? AND created_at > ? AND created_at < ?',
"HocSignup#{year}",
"#{year}-08-01",
"#{year.to_i + 1}-01-01"
).
group(:name, :email).
group_and_count(
Sequel.as(
Sequel.qualify(:forms, :created_at).cast(:date),
:created_at_day
)
).
order(:created_at_day).
all.
map do |row|
[row[:created_at_day].strftime("%m-%d"), row[:count].to_i]
end
end
end

# Construct the hash {MM-DD => [count2014, count2015, count2016]}.
# Start by constructing the key space as the union of the MM-DD dates.
dates = Set.new []
event_signup_data.values.each do |data|
data.each do |day|
dates.add day[0]
end
end
# Then populate the hash, using zeros as placeholders for value counts.
event_signups_by_day = {}
dates.sort.each do |date|
event_signups_by_day[date] = Array.new(event_signup_data.length, 0)
end
# Finally populate the values of our hash.
event_signup_data.values.each_with_index do |data, index|
data.each do |day|
event_signups_by_day[day[0]][index] = day[1]
end
end

render locals: {event_signups_by_day: event_signups_by_day.to_a}
end

def students_served
SeamlessDatabasePool.use_persistent_read_connection do
@data = Properties.get(:hoc_metrics)
Expand Down
94 changes: 0 additions & 94 deletions dashboard/app/views/admin_hoc/event_signups.html.haml

This file was deleted.

3 changes: 0 additions & 3 deletions dashboard/app/views/admin_reports/directory.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
%br

%h3 Hour of Code
= link_to hoc_event_signups_path do
Event Signups
%br
= link_to hoc_students_served_path do
Students Served

Expand Down
1 change: 0 additions & 1 deletion dashboard/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ module OPS

# HOC dashboards.
get '/admin/hoc/students_served', to: 'admin_hoc#students_served', as: 'hoc_students_served'
get '/admin/hoc/event_signups', to: 'admin_hoc#event_signups', as: 'hoc_event_signups'

# internal report dashboards
get '/admin/levels', to: 'admin_reports#level_completions', as: 'level_completions'
Expand Down
3 changes: 0 additions & 3 deletions dashboard/test/controllers/admin_hoc_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ class AdminHocControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers

setup do
# Stub the DB[:forms] table (used by :event_signups).
DB.stubs(:[]).returns(stub(where: stub(group: stub(group_and_count: stub(order: stub(all: []))))))
# Stub the Properties table (used by :students_served).
Properties.stubs(:get).returns(nil)
end

generate_admin_only_tests_for :event_signups
generate_admin_only_tests_for :students_served
end