Class: Hyrax::Statistics::QueryService Deprecated
- Inherits:
-
Object
- Object
- Hyrax::Statistics::QueryService
- Extended by:
- Deprecation
- Defined in:
- app/services/hyrax/statistics/query_service.rb
Overview
Deprecated.
for removal in 6.0.0
Direct Known Subclasses
Instance Method Summary collapse
- #build_date_query(start_datetime, end_datetime) ⇒ Object
-
#find_by_date_created(start_datetime, end_datetime = nil) ⇒ Object
query to find works created during the time range.
- #find_public_in_date_range(start_datetime, end_datetime = nil) ⇒ Object
- #find_registered_in_date_range(start_datetime, end_datetime = nil) ⇒ Object
- #relation ⇒ Object
- #where_public ⇒ Object
- #where_registered ⇒ Object
Instance Method Details
#build_date_query(start_datetime, end_datetime) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/services/hyrax/statistics/query_service.rb', line 35 def build_date_query(start_datetime, end_datetime) start_date_str = start_datetime.utc.strftime(date_format) end_date_str = if end_datetime.blank? "*" else end_datetime.utc.strftime(date_format) end "system_create_dtsi:[#{start_date_str} TO #{end_date_str}]" end |
#find_by_date_created(start_datetime, end_datetime = nil) ⇒ Object
query to find works created during the time range
14 15 16 17 |
# File 'app/services/hyrax/statistics/query_service.rb', line 14 def find_by_date_created(start_datetime, end_datetime = nil) return [] if start_datetime.blank? # no date just return nothing relation.where(build_date_query(start_datetime, end_datetime)) end |
#find_public_in_date_range(start_datetime, end_datetime = nil) ⇒ Object
23 24 25 |
# File 'app/services/hyrax/statistics/query_service.rb', line 23 def find_public_in_date_range(start_datetime, end_datetime = nil) find_by_date_created(start_datetime, end_datetime).merge(where_public) end |
#find_registered_in_date_range(start_datetime, end_datetime = nil) ⇒ Object
19 20 21 |
# File 'app/services/hyrax/statistics/query_service.rb', line 19 def find_registered_in_date_range(start_datetime, end_datetime = nil) find_by_date_created(start_datetime, end_datetime).merge(where_registered) end |
#relation ⇒ Object
47 48 49 |
# File 'app/services/hyrax/statistics/query_service.rb', line 47 def relation Hyrax::WorkRelation.new end |
#where_public ⇒ Object
27 28 29 |
# File 'app/services/hyrax/statistics/query_service.rb', line 27 def where_public where_access_is 'public' end |
#where_registered ⇒ Object
31 32 33 |
# File 'app/services/hyrax/statistics/query_service.rb', line 31 def where_registered where_access_is 'registered' end |