Browse Source

refactor: linting

pull/1034/head
natdeanlewissoftwire 4 years ago
parent
commit
aae0bf32a8
  1. 8
      app/controllers/locations_controller.rb

8
app/controllers/locations_controller.rb

@ -121,11 +121,9 @@ class LocationsController < ApplicationController
day = location_params["startdate(3i)"] day = location_params["startdate(3i)"]
month = location_params["startdate(2i)"] month = location_params["startdate(2i)"]
year = location_params["startdate(1i)"] year = location_params["startdate(1i)"]
if [day, month, year].none?(&:blank?) && Date.valid_date?(year.to_i, month.to_i, day.to_i) @location.startdate = if [day, month, year].none?(&:blank?) && Date.valid_date?(year.to_i, month.to_i, day.to_i)
@location.startdate = Time.zone.local(year.to_i, month.to_i, day.to_i) Time.zone.local(year.to_i, month.to_i, day.to_i)
else end
@location.startdate = nil
end
if @location.save(context: :startdate) if @location.save(context: :startdate)
redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route]) redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route])
else else

Loading…
Cancel
Save