Class: Hyrax::Statistics::Depositors::Summary

Inherits:
Object
  • Object
show all
Includes:
Blacklight::SearchHelper
Defined in:
app/services/hyrax/statistics/depositors/summary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_date, end_date) ⇒ Summary

Returns a new instance of Summary.

Parameters:

  • start_date (Time)

    optionally specify the start date to gather the stats from

  • end_date (Time)

    optionally specify the end date to gather the stats from



10
11
12
13
# File 'app/services/hyrax/statistics/depositors/summary.rb', line 10

def initialize(start_date, end_date)
  @start_dt = start_date
  @end_dt = end_date
end

Instance Attribute Details

#end_dtObject

Returns the value of attribute end_dt.



15
16
17
# File 'app/services/hyrax/statistics/depositors/summary.rb', line 15

def end_dt
  @end_dt
end

#start_dtObject

Returns the value of attribute start_dt.



15
16
17
# File 'app/services/hyrax/statistics/depositors/summary.rb', line 15

def start_dt
  @start_dt
end

Instance Method Details

#depositorsObject



17
18
19
20
21
22
23
24
# File 'app/services/hyrax/statistics/depositors/summary.rb', line 17

def depositors
  # step through the array by twos to get each pair
  results.map do |key, deposits|
    user = ::User.find_by_user_key(key)
    raise "Unable to find user '#{key}'\nResults was: #{results.inspect}" unless user
    { key: key, deposits: deposits, user: user }
  end
end