Add withdrawn events to conference dashboard

Signed-off-by: Carlos Coelho <carlos@vinta.com.br>
This commit is contained in:
Carlos Coelho 2018-02-18 16:17:29 -03:00 committed by Stella Rouzi
parent 5f7029d28e
commit 8457dafbf6
4 changed files with 61 additions and 10 deletions

View file

@ -300,7 +300,7 @@ Lint/UnusedBlockArgument:
# Offense count: 136
Metrics/AbcSize:
Max: 86
Max: 98
# Offense count: 258
# Configuration parameters: CountComments, ExcludedMethods.
@ -320,7 +320,7 @@ Metrics/LineLength:
# Offense count: 133
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 56
Max: 63
# Offense count: 4
# Configuration parameters: CountComments.

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

@ -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