Merge branch 'master' into skylight-instrumentation

This commit is contained in:
James Mason 2018-02-22 20:13:15 -08:00 • committed by GitHub
commit 6922fd6b1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 133 additions and 12 deletions

View file

@ -20,6 +20,10 @@ module Admin
@total_submissions = Event.count
@new_submissions = Event.where('created_at > ?', current_user.last_sign_in_at).count
@total_withdrawn = Event.where(state: :withdrawn).count
@new_withdrawn = Event
.where('state = ? and created_at > ?', 'withdrawn', current_user.last_sign_in_at).count
@active_conferences = Conference.get_active_conferences_for_dashboard # pending or the last two
@deactive_conferences = Conference
.get_conferences_without_active_for_dashboard(@active_conferences) # conferences without active
@ -116,13 +120,19 @@ module Admin
@total_reg = @conference.registrations.count
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
@total_submissions = @program.events.count
@new_submissions = @program.events
@all_events = @program.events
@total_submissions = @all_events.count
@new_submissions = @all_events
.where('created_at > ?', current_user.last_sign_in_at).count
@program_length = @conference.current_program_hours
@new_program_length = @conference.new_program_hours(current_user.last_sign_in_at)
@total_withdrawn = @all_events.where(state: :withdrawn).count
@new_withdrawn = @all_events
.where('state = "withdrawn" and created_at > ?', current_user.last_sign_in_at).count
# Step by step list
@conference_progress = @conference.get_status
@ -162,13 +172,17 @@ module Admin
# Doughnut charts
@event_type_distribution = @conference.event_type_distribution
@event_type_distribution_confirmed = @conference.event_type_distribution(:confirmed)
@event_type_distribution_withdrawn = @conference.event_type_distribution(:withdrawn)
@difficulty_levels_distribution = @conference.difficulty_levels_distribution
@difficulty_levels_distribution_confirmed = @conference
.difficulty_levels_distribution(:confirmed)
@difficulty_levels_distribution_withdrawn = @conference
.difficulty_levels_distribution(:withdrawn)
@tracks_distribution = @conference.tracks_distribution
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
@tracks_distribution_withdrawn = @conference.tracks_distribution(:withdrawn)
# Recent actions information
@recent_events = @conference.program.events.limit(5).order(created_at: :desc)

View file

@ -1029,7 +1029,7 @@ class Conference < ApplicationRecord
# * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil)
grouped = if state
program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
program.events.select(group_by_id).where('state = ?', state).group(group_by_id)
else
program.events.select(group_by_id).group(group_by_id)
end

View file

@ -1,4 +1,5 @@
class Registration < ApplicationRecord
require 'csv'
belongs_to :user
belongs_to :conference

View file

@ -1,5 +1,5 @@
.row
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-user.fa-lg
%span.fa.fa-lg
@ -11,7 +11,7 @@
%span.label.label-success{ title: "+ #{@new_user} since you last logged in!" }
+
= @new_user
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-check-square.fa-lg
%span.fa.fa-lg
@ -23,7 +23,7 @@
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
+
= @new_reg
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-file-text.fa-lg
%span.fa.fa-lg
@ -35,6 +35,18 @@
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
+
= @new_submissions
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-archive.fa-lg
%span.fa.fa-lg
= @total_withdrawn
%p
%small
#{'Withdrawn'.pluralize(@total_withdrawn)}
- if @new_withdrawn
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
+
= @new_withdrawn
.row#registrations
.col-md-8

View file

@ -3,7 +3,7 @@
Dashboard for #{@conference.title}
%hr
.row
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-user.fa-lg
%span.fa.fa-lg
@ -16,7 +16,7 @@
+
= @new_reg
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-check-square.fa-lg
%span.fa.fa-lg
@ -29,7 +29,7 @@
+
= @new_submissions
.col-sm-4.col-xs-4
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-file-text.fa-lg
%span.fa.fa-lg
@ -42,6 +42,19 @@
+
= @new_program_length
.col-sm-3.col-xs-3
.dashbox.text-center
%span.fa.fa-archive.fa-lg
%span.fa.fa-lg
= @total_withdrawn
%p
%small
#{'Withdrawn'.pluralize(@total_withdrawn)}
- if @new_withdrawn
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
+
= @new_withdrawn
.row
.col-md-12
.row
@ -91,6 +104,10 @@
%a{ href: '#distribution_confirmed', 'data-toggle' => 'tab' }
%span.fa.fa-comment
Confirmed
%li
%a{ href: '#distribution_withdrawn', 'data-toggle' => 'tab' }
%span.fa.fa-archive
Withdrawn
.tab-content
.tab-pane.active#distribution_all
.row
@ -108,6 +125,14 @@
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution_confirmed}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution_confirmed}
.tab-pane#distribution_withdrawn
.row
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Event types', data: @event_type_distribution_withdrawn}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution_withdrawn}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution_withdrawn}
.row
.col-md-8