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
result = adapter.query(
:packet_flow, environment.deployment_namespace,
params[:interval] || "minute",
(Time.zone.parse(params[:from]) rescue 1.hour.ago).to_s,
(Time.zone.parse(params[:to]) rescue Time.current).to_s
parse_time(params[:from], 1.hour.ago).to_s,
parse_time(params[:to], Time.current).to_s
)
respond_to do |format|
......@@ -35,6 +35,12 @@ module Projects
private
def parse_time(params, fallback)
Time.zone.parse(params) || fallback
rescue
fallback
end
def environment
@environment ||= project.environments.find(params[:environment_id])
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