Class: QaServer::TimePeriodService
- Inherits:
-
Object
- Object
- QaServer::TimePeriodService
- Defined in:
- app/services/qa_server/time_period_service.rb
Class Method Summary collapse
-
.where_clause_for_last_12_months(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 12 months and optionally an authority.
-
.where_clause_for_last_24_hours(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 24 hours and optionally an authority.
-
.where_clause_for_last_30_days(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 30 days and optionally an authority.
Class Method Details
.where_clause_for_last_12_months(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 12 months and optionally an authority.
60 61 62 63 64 |
# File 'app/services/qa_server/time_period_service.rb', line 60 def where_clause_for_last_12_months(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) validate_params(auth_name, auth_table, dt_table) where_clause = where_for_dt_stamp(dt_table, dt_column, 1.year) (where_clause, auth_name, auth_table) end |
.where_clause_for_last_24_hours(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 24 hours and optionally an authority.
20 21 22 23 24 |
# File 'app/services/qa_server/time_period_service.rb', line 20 def where_clause_for_last_24_hours(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) validate_params(auth_name, auth_table, dt_table) where_clause = where_for_dt_stamp(dt_table, dt_column, 1.day) (where_clause, auth_name, auth_table) end |
.where_clause_for_last_30_days(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) ⇒ Hash
Construct a hash to pass to ActiveRecord where method limiting to last 30 days and optionally an authority.
40 41 42 43 44 |
# File 'app/services/qa_server/time_period_service.rb', line 40 def where_clause_for_last_30_days(auth_name: nil, auth_table: nil, dt_table: nil, dt_column: :dt_stamp) validate_params(auth_name, auth_table, dt_table) where_clause = where_for_dt_stamp(dt_table, dt_column, 1.month) (where_clause, auth_name, auth_table) end |