Skip to content

Commit

Permalink
Merge pull request #802 from Vizzuality/backend/LET-1392-enable-addit…
Browse files Browse the repository at this point in the history
…ional-landscapes

LET-1392 [BE] Update priority locations translations
  • Loading branch information
yulia-bel authored Nov 29, 2023
2 parents 2e7c6a2 + 9c575ed commit fe043ad
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion backend/app/services/importers/geo_jsons/mosaics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ class Mosaics < Base
"Corazón Amazonía" => {name_en: "Amazon Heart", name_es: "Corazón Amazonía", name_pt: "Coração da Amazônia"},
"Piedemonte Amazónico - Macizo" => {name_en: "Amazonian Piedmont Massif", name_es: "Piedemonte Amazónico - Macizo", name_pt: "Maciço Piedemonte Amazônico"},
"Transición Orinoquía" => {name_en: "Orinoquía Transition", name_es: "Transición Orinoquía", name_pt: "Transição Orinoquía"},
"Orinoquía" => {name_en: "Orinoquía", name_es: "Orinoquía", name_pt: "Orinoquía"}
"Orinoquía" => {name_en: "Orinoquía", name_es: "Orinoquía", name_pt: "Orinoquía"},
"Cordillera Oriental" => {name_en: "Eastern Mountain Range", name_es: "Cordillera Oriental", name_pt: "Cordilheira Oriental"},
"Cordillera Central" => {name_en: "Central Mountain Range", name_es: "Cordillera Central", name_pt: "Cordilheira Central"},
"Pacífico - Marino Costero" => {name_en: "Pacific - Coastal Marine", name_es: "Pacífico - Marino Costero", name_pt: "Pacífico - Marinho Costeiro"},
"Caribe" => {name_en: "Caribbean", name_es: "Caribe", name_pt: "Caribe"},
"Transición Pacífico - Caribe" => {name_en: "Pacific - Caribbean Transition", name_es: "Transición Pacífico - Caribe", name_pt: "Transição Pacífico - Caribe"}
}
PRIORITY_LANDSCAPE_CODES = {
"Corazón Amazonía" => "priority-landscape-amazon-heart",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class UpdatePriorityLandscapeTranslations < ActiveRecord::Migration[7.0]
def up
Rake::Task["priority_landscapes:translate"].execute
Location.priority_landscape.update_all visible: true
end

def down
new_location_names_en = ["Eastern Mountain", "Central Mountain Range", "Pacific - Coastal Marine", "Caribbean", "Pacific - Caribbean Transition"]
Location.priority_landscape.where(name_en: new_location_names_en).update_all(visible: false)
end
end
2 changes: 1 addition & 1 deletion backend/db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backend/spec/services/importers/geo_jsons/mosaics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

it "assigns correct attributes to first priority landscape" do
location = priority_landscapes.find_by name_es: "Cordillera Oriental"
expect(location.name_en).to eq("Cordillera Oriental")
expect(location.visible).to be_falsey
expect(location.name_en).to eq("Eastern Mountain Range")
expect(location.visible).to be_truthy
expect(location.code).to eq(Importers::GeoJsons::Mosaics::PRIORITY_LANDSCAPE_CODES["Cordillera Oriental"])
end

Expand Down

0 comments on commit fe043ad

Please sign in to comment.