From ad14fbf774489a3a75bc76651add2a775ba866c8 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 14 Jul 2022 14:49:35 +0100 Subject: [PATCH] lint --- app/models/form/setup/questions/location_id.rb | 2 +- app/models/form/setup/questions/scheme_id.rb | 2 +- app/models/scheme.rb | 2 +- app/views/locations/edit.html.erb | 4 ++-- app/views/locations/new.html.erb | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/form/setup/questions/location_id.rb b/app/models/form/setup/questions/location_id.rb index dae770a0d..9e6fb6038 100644 --- a/app/models/form/setup/questions/location_id.rb +++ b/app/models/form/setup/questions/location_id.rb @@ -13,7 +13,7 @@ class Form::Setup::Questions::LocationId < ::Form::Question answer_opts = {} return answer_opts unless ActiveRecord::Base.connected? - Location.select(:id, :postcode, :name).where("startdate <= ? or startdate IS NULL", Date.today).each_with_object(answer_opts) do |location, hsh| + Location.select(:id, :postcode, :name).where("startdate <= ? or startdate IS NULL", Time.zone.today).each_with_object(answer_opts) do |location, hsh| hsh[location.id.to_s] = { "value" => location.postcode, "hint" => location.name } hsh end diff --git a/app/models/form/setup/questions/scheme_id.rb b/app/models/form/setup/questions/scheme_id.rb index 424be0c9a..e758b8444 100644 --- a/app/models/form/setup/questions/scheme_id.rb +++ b/app/models/form/setup/questions/scheme_id.rb @@ -22,7 +22,7 @@ class Form::Setup::Questions::SchemeId < ::Form::Question def displayed_answer_options(case_log) return {} unless case_log.created_by - user_org_scheme_ids = Scheme.select(:id).where(owning_organisation_id: case_log.created_by.organisation_id).joins(:locations).merge(Location.where("startdate <= ? or startdate IS NULL", Date.today)).map(&:id) + user_org_scheme_ids = Scheme.select(:id).where(owning_organisation_id: case_log.created_by.organisation_id).joins(:locations).merge(Location.where("startdate <= ? or startdate IS NULL", Time.zone.today)).map(&:id) answer_options.select do |k, _v| user_org_scheme_ids.include?(k.to_i) end diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 98f0b2dcf..bdd9671ed 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -148,7 +148,7 @@ class Scheme < ApplicationRecord end def appended_text - "(#{locations.count { |location| location.startdate.blank? || location.startdate <= Date.today }} locations)" + "(#{locations.count { |location| location.startdate.blank? || location.startdate <= Time.zone.today }} locations)" end def hint diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb index 696c24c53..227605485 100644 --- a/app/views/locations/edit.html.erb +++ b/app/views/locations/edit.html.erb @@ -21,7 +21,7 @@ <%= f.govuk_text_field :name, label: { text: I18n.t("questions.location.name"), size: "m" }, - hint: { text: I18n.t("hints.location.name")} %> + hint: { text: I18n.t("hints.location.name") } %> <%= f.govuk_number_field :units, label: { text: I18n.t("questions.location.units"), size: "m" }, @@ -45,7 +45,7 @@ legend: { text: I18n.t("questions.location.wheelchair_adaptation"), size: "m" } %> <%= f.govuk_date_field :startdate, - legend: { text:I18n.t("questions.location.startdate"), size: "m" }, + legend: { text: I18n.t("questions.location.startdate"), size: "m" }, width: 20 %> <%= govuk_section_break(visible: true, size: "m") %> diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index f8cf6321d..669a39594 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -43,9 +43,9 @@ wheelchair_user_selection, :id, :name, - hint: { text:I18n.t("hints.location.wheelchair_adaptation")}, + hint: { text: I18n.t("hints.location.wheelchair_adaptation") }, legend: { text: I18n.t("questions.location.wheelchair_adaptation"), size: "m" } %> - + <%= f.govuk_date_field :startdate, legend: { text: I18n.t("questions.location.startdate"), size: "m" }, width: 20 %>