Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support :date column type #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/javascripts/reports_kit/lib/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
2 changes: 2 additions & 0 deletions lib/reports_kit/reports/filter_with_series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion lib/reports_kit/reports/inferrable_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class InferrableConfiguration
SUPPORTED_COLUMN_TYPES = [
:boolean,
:datetime,
:date,
:integer,
:string,
:text
Expand Down Expand Up @@ -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
Expand Down