Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit a19b280

Browse files
author
Laurent Curau
authored
Merge pull request #503 from alphagov/laurent/fix-org-importer
Fix organisation importer
2 parents 7134358 + d830ed1 commit a19b280

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/services/legacy/organisation_import_service.rb

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ def initialize(legacy_organisation)
66
end
77

88
def run
9-
if organisation.persisted?
10-
organisation.update_columns(organisation_attributes)
11-
else
12-
organisation.update_attributes(organisation_attributes)
13-
end
9+
organisation.update_attributes!(organisation_attributes)
1410
end
1511

1612
def organisation_attributes
@@ -30,7 +26,7 @@ def organisation_attributes
3026
foi_web: legacy_organisation["foi-web"],
3127
category: legacy_organisation["category"],
3228
org_type: get_org_type,
33-
ancestry: get_parent_organisation_id
29+
parent: get_parent_organisation
3430
}
3531
end
3632

@@ -40,7 +36,7 @@ def organisation
4036
@organisation ||= Organisation.find_or_initialize_by(name: legacy_organisation["name"])
4137
end
4238

43-
def get_parent_organisation_id
39+
def get_parent_organisation
4440
Organisation.find_by(name: groups[0]["name"]) if groups.any?
4541
end
4642

0 commit comments

Comments
 (0)