Browse Source

lint

pull/744/head
Kat 3 years ago
parent
commit
ad14fbf774
  1. 2
      app/models/form/setup/questions/location_id.rb
  2. 2
      app/models/form/setup/questions/scheme_id.rb
  3. 2
      app/models/scheme.rb

2
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

2
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

2
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

Loading…
Cancel
Save