File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,16 +64,13 @@ class Location < ApplicationRecord
6464 validates :url , url : true , allow_nil : true
6565 validates :urn , uniqueness : true , allow_nil : true
6666
67- with_options if : :clinic? do
68- validates :team , presence : true
69- end
70-
7167 with_options if : :community_clinic? do
7268 validates :ods_code , exclusion : { in : :organisation_ods_code }
7369 end
7470
7571 with_options if : :generic_clinic? do
7672 validates :ods_code , inclusion : { in : :organisation_ods_code }
73+ validates :team , presence : true
7774 end
7875
7976 with_options if : :gp_practice? do
@@ -121,9 +118,9 @@ def create_default_programme_year_groups!(programmes)
121118
122119 private
123120
124- def organisation_ods_code
125- [ team &.organisation &.ods_code ]
126- end
121+ def organisation_ods_code = [ team &.organisation &.ods_code ] . compact
127122
128- def fhir_mapper = @fhir_mapper ||= FHIRMapper ::Location . new ( self )
123+ def fhir_mapper
124+ @fhir_mapper ||= FHIRMapper ::Location . new ( self )
125+ end
129126end
Original file line number Diff line number Diff line change 6565 name { "#{ Faker ::University . name } Clinic" }
6666
6767 sequence ( :ods_code , 100 ) { "CL#{ _1 } " }
68-
69- organisation
7068 end
7169
7270 factory :generic_clinic do
Original file line number Diff line number Diff line change 175175 "gias_establishment_number" => nil ,
176176 "gias_local_authority_code" => nil ,
177177 "id" => location . id ,
178- "is_attached_to_organisation" => true ,
178+ "is_attached_to_organisation" => false ,
179179 "name" => location . name ,
180180 "ods_code" => location . ods_code ,
181181 "status" => "unknown" ,
You can’t perform that action at this time.
0 commit comments