From b4ab5d4a0808d4068b8323e769e62ec513468536 Mon Sep 17 00:00:00 2001 From: Fareesh Vijayarangam Date: Wed, 25 Apr 2018 16:46:36 +0530 Subject: [PATCH 1/2] Try to support date column --- lib/reports_kit/reports/filter_with_series.rb | 2 ++ lib/reports_kit/reports/inferrable_configuration.rb | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/reports_kit/reports/filter_with_series.rb b/lib/reports_kit/reports/filter_with_series.rb index 9c1577d..3c51960 100644 --- a/lib/reports_kit/reports/filter_with_series.rb +++ b/lib/reports_kit/reports/filter_with_series.rb @@ -5,12 +5,14 @@ class FilterWithSeries association: FilterTypes::Records, boolean: FilterTypes::Boolean, datetime: FilterTypes::Datetime, + date: FilterTypes::Datetime, integer: FilterTypes::Number, string: FilterTypes::String } COLUMN_TYPES_FILTER_TYPE_CLASSES = { boolean: FilterTypes::Boolean, datetime: FilterTypes::Datetime, + date: FilterTypes::Datetime, integer: FilterTypes::Number, string: FilterTypes::String } diff --git a/lib/reports_kit/reports/inferrable_configuration.rb b/lib/reports_kit/reports/inferrable_configuration.rb index 2941741..940f9f8 100644 --- a/lib/reports_kit/reports/inferrable_configuration.rb +++ b/lib/reports_kit/reports/inferrable_configuration.rb @@ -4,6 +4,7 @@ class InferrableConfiguration SUPPORTED_COLUMN_TYPES = [ :boolean, :datetime, + :date, :integer, :string, :text @@ -46,7 +47,7 @@ def configured_by_model? end def configured_by_time? - column_type == :datetime + column_type == :datetime || column_type == :date end def reflection From 0bb6ebf787c9d2cf7839b8e7eb29c558ac55e39b Mon Sep 17 00:00:00 2001 From: Fareesh Vijayarangam Date: Wed, 25 Apr 2018 17:04:47 +0530 Subject: [PATCH 2/2] Add 1 and 2 weeks to filters --- app/assets/javascripts/reports_kit/lib/report.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/reports_kit/lib/report.js b/app/assets/javascripts/reports_kit/lib/report.js index 0967782..341172f 100644 --- a/app/assets/javascripts/reports_kit/lib/report.js +++ b/app/assets/javascripts/reports_kit/lib/report.js @@ -73,6 +73,8 @@ ReportsKit.Report = (function() { format: 'MMM D, YYYY' }, ranges: { + 'Last 7 Days': [moment().subtract(7, 'days'), moment()], + 'Last 14 Days': [moment().subtract(14, 'days'), moment()], 'Last 30 Days': [moment().subtract(30, 'days'), moment()], 'Last 2 Months': [moment().subtract(2, 'months'), moment()], 'Last 3 Months': [moment().subtract(3, 'months'), moment()],