Skip to content

Commit

Permalink
Hackathons API: Include country (common name)
Browse files Browse the repository at this point in the history
in addition to the existing `country_code`
  • Loading branch information
garyhtou committed Aug 14, 2023
1 parent 36aec08 commit b3dcc93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/hackathon/regional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def general_location
[city, province, country_code].compact.join(", ")
end

def country
ISO3166::Country[country_code]&.common_name
end

def to_location
Location.new(city, province, country_code)
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/api/hackathons/_hackathon.json.v1.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ shape_for hackathon, json do
json.location do
json.city hackathon.city
json.province hackathon.province
json.country hackathon.country
json.country_code hackathon.country_code

json.longitude hackathon.longitude
json.latitude hackathon.latitude
end
Expand Down

0 comments on commit b3dcc93

Please sign in to comment.