Fix empty parameter causing db exception
This commit is contained in:
@ -37,7 +37,7 @@ 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].to_s.nil? ? 'year' : params[:interval]
|
interval = params[:interval].to_s.empty? ? '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))
|
||||||
|
Reference in New Issue
Block a user