Use sane default values
This commit is contained in:
@ -8,8 +8,6 @@ $(document).ready(function () {
|
|||||||
var graph;
|
var graph;
|
||||||
var groups;
|
var groups;
|
||||||
|
|
||||||
var params = new URLSearchParams(window.location.search.slice(1));
|
|
||||||
|
|
||||||
var buildChartGroups = function() {
|
var buildChartGroups = function() {
|
||||||
return _.map(chartData, function(element) {
|
return _.map(chartData, function(element) {
|
||||||
return {
|
return {
|
||||||
@ -39,12 +37,13 @@ $(document).ready(function () {
|
|||||||
style: 'circle'
|
style: 'circle'
|
||||||
},
|
},
|
||||||
legend: true,
|
legend: true,
|
||||||
start: params.get('from'),
|
start: $('#from-date')[0].value,
|
||||||
end: params.get('to')
|
end: $('#to-date')[0].value
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var refreshData = function(callback) {
|
var refreshData = function(callback) {
|
||||||
|
var params = new URLSearchParams(window.location.search.slice(1));
|
||||||
var jqxhr = $.ajax('rfc-activity-history.json', {
|
var jqxhr = $.ajax('rfc-activity-history.json', {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {from: params.get('from'), to: params.get('to'), interval: params.get('interval')},
|
data: {from: params.get('from'), to: params.get('to'), interval: params.get('interval')},
|
||||||
|
@ -37,9 +37,9 @@ class StatisticsController < ApplicationController
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render 'rfc_activity_history' }
|
format.html { render 'rfc_activity_history' }
|
||||||
format.json do
|
format.json do
|
||||||
interval = params[:interval] || 'year'
|
interval = params[:interval].to_s.nil? ? 'year' : params[:interval]
|
||||||
from = DateTime.strptime(params[:from], '%Y-%M-%D') rescue DateTime.new(0)
|
from = DateTime.strptime(params[:from], '%Y-%m-%d') rescue DateTime.new(0)
|
||||||
to = DateTime.strptime(params[:to], '%Y-%M-%D') rescue DateTime.now
|
to = DateTime.strptime(params[:to], '%Y-%m-%d') rescue DateTime.now
|
||||||
render(json: ranged_rfc_data(interval, from, to))
|
render(json: ranged_rfc_data(interval, from, to))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user