Skip to content

Commit 8c2a513

Browse files
committed
Fix GIAS import call to update sites
The sites were only being updated in the last batch of schools, I missed calling it in another point. Also fixed the conflict target when importing sites to match the URN, site unique index rather than URN, nil site index.
1 parent 9408e2a commit 8c2a513

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/lib/mavis_cli/gias/import.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def call(input_file:, **)
5252

5353
if schools.size >= batch_size
5454
import_schools(schools)
55+
update_sites(schools)
5556
schools.clear
5657
end
5758

@@ -116,8 +117,7 @@ def update_sites(schools)
116117
Location.import!(
117118
sites,
118119
on_duplicate_key_update: {
119-
conflict_target: %i[id],
120-
index_predicate: "site IS NULL",
120+
conflict_target: %i[urn site],
121121
columns: %i[
122122
gias_establishment_number
123123
gias_local_authority_code

0 commit comments

Comments
 (0)