Class: Hyrax::Statistics::Works::Count
- Inherits:
-
Object
- Object
- Hyrax::Statistics::Works::Count
- Defined in:
- app/services/hyrax/statistics/works/count.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Class Method Summary collapse
-
.by_permission(start_date: nil, end_date: nil) ⇒ Hash
Retrieves the count of works in the system filtered by the start_date and end_date if present.
Instance Method Summary collapse
-
#by_permission ⇒ Hash
Retrieves the count of works in the system filtered by the start_date and end_date if present.
-
#initialize(start_date = nil, end_date = nil) ⇒ Count
constructor
A new instance of Count.
Constructor Details
#initialize(start_date = nil, end_date = nil) ⇒ Count
Returns a new instance of Count.
20 21 22 23 |
# File 'app/services/hyrax/statistics/works/count.rb', line 20 def initialize(start_date = nil, end_date = nil) @start_date = start_date @end_date = end_date end |
Instance Attribute Details
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
5 6 7 |
# File 'app/services/hyrax/statistics/works/count.rb', line 5 def end_date @end_date end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
5 6 7 |
# File 'app/services/hyrax/statistics/works/count.rb', line 5 def start_date @start_date end |
Class Method Details
.by_permission(start_date: nil, end_date: nil) ⇒ Hash
Retrieves the count of works in the system filtered by the start_date and end_date if present
14 15 16 |
# File 'app/services/hyrax/statistics/works/count.rb', line 14 def self.(start_date: nil, end_date: nil) new(start_date, end_date). end |
Instance Method Details
#by_permission ⇒ Hash
Retrieves the count of works in the system filtered by the start_date and end_date if present
32 33 34 35 36 37 38 39 40 41 |
# File 'app/services/hyrax/statistics/works/count.rb', line 32 def return if start_date works_count = {} works_count[:total] = query_service.count works_count[:public] = query_service.where_public.count works_count[:registered] = query_service.where_registered.count works_count[:private] = works_count[:total] - (works_count[:registered] + works_count[:public]) works_count end |