Commit 5f6da88d authored by Sean Arnold's avatar Sean Arnold Committed by Stan Hu

Fix time parse fallback

- Time.zone.parse wasn't always throwing an error
parent 255e6054
...@@ -17,8 +17,8 @@ module Projects ...@@ -17,8 +17,8 @@ module Projects
result = adapter.query( result = adapter.query(
:packet_flow, environment.deployment_namespace, :packet_flow, environment.deployment_namespace,
params[:interval] || "minute", params[:interval] || "minute",
(Time.zone.parse(params[:from]) rescue 1.hour.ago).to_s, parse_time(params[:from], 1.hour.ago).to_s,
(Time.zone.parse(params[:to]) rescue Time.current).to_s parse_time(params[:to], Time.current).to_s
) )
respond_to do |format| respond_to do |format|
...@@ -35,6 +35,12 @@ module Projects ...@@ -35,6 +35,12 @@ module Projects
private private
def parse_time(params, fallback)
Time.zone.parse(params) || fallback
rescue
fallback
end
def environment def environment
@environment ||= project.environments.find(params[:environment_id]) @environment ||= project.environments.find(params[:environment_id])
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment