pgeraghty/rails_admin_charts — pull request #8 by Aastha-Tangri (2014-12-12 13:07:26+00:00)
Title: Don't pass hardcoded values

When I was trying to override the default value of since using
def self.graph_data since=30.days.ago
[
{
name: 'Admin Users',
pointInterval: point_interval = 1.day * 1000,
pointStart: start_point = since.to_i * 1000,
data: self.where(type: 'Admin').delta_records_since(since)
},
{
name: 'Standard Users',
pointInterval: point_interval,
pointStart: start_point,
data: self.where(type: nil).delta_records_since(since)
}
]
end
The value is hardcoded as 100 in _chart.html.erb. Removing the hardcoded value from the view, the new default value would be 30.days.ago instead of 100.days.ago