Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New hub data format #72

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/lib/hub/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def load

read_file(@path) do |data|
Hub.create!(
name: data['Teaching School Hub name'],
phone: data['Contact phone number'],
email: data['Email address'],
website: data['TSH website, where available'],
areas: get_local_authorities(data['Teaching School Hub area'].split(' - ').last)
name: data['name'],
phone: data['phone'],
email: data['email'],
website: data['website'],
areas: get_local_authorities(data['areas'])
)
end
end
Expand All @@ -55,7 +55,7 @@ def get_local_authorities(string)
end
inversed_map = @authorities_with_comas_map.invert

mapped.split(', ').map do |str|
mapped.split(';').map do |str|
inversed_map[str] || str
end
end
Expand Down
Loading