Class: Sufia::AdminStatsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/sufia/admin_stats_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stats_filters, limit) ⇒ AdminStatsPresenter

Returns a new instance of AdminStatsPresenter.



6
7
8
9
10
11
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 6

def initialize(stats_filters, limit)
  @stats_filters = stats_filters
  @start_date = stats_filters[:start_date]
  @end_date = stats_filters[:end_date]
  @limit = limit
end

Instance Attribute Details

#deposit_statsObject

Returns the value of attribute deposit_stats.



3
4
5
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 3

def deposit_stats
  @deposit_stats
end

#depositorsObject

Returns the value of attribute depositors.



3
4
5
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 3

def depositors
  @depositors
end

#end_dateObject (readonly)

Returns the value of attribute end_date.



4
5
6
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 4

def end_date
  @end_date
end

#limitObject (readonly)

Returns the value of attribute limit.



4
5
6
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 4

def limit
  @limit
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



4
5
6
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 4

def start_date
  @start_date
end

#stats_filtersObject (readonly)

Returns the value of attribute stats_filters.



4
5
6
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 4

def stats_filters
  @stats_filters
end

Instance Method Details

#active_usersObject



17
18
19
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 17

def active_users
  @active_users ||= stats.top_depositors
end

#date_filter_stringObject



33
34
35
36
37
38
39
40
41
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 33

def date_filter_string
  if start_date.blank?
    "unfiltered"
  elsif end_date.blank?
    "#{start_date} to #{Date.current}"
  else
    "#{start_date} to #{end_date}"
  end
end

#files_countObject



25
26
27
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 25

def files_count
  @files_count ||= stats.document_by_permission
end

#recent_usersObject



13
14
15
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 13

def recent_users
  @recent_users ||= stats.recent_users
end

#top_formatsObject



21
22
23
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 21

def top_formats
  @top_formats ||= stats.top_formats
end

#users_countObject



29
30
31
# File 'app/presenters/sufia/admin_stats_presenter.rb', line 29

def users_count
  @users_count ||= stats.users_count
end