Skip to content

Commit

Permalink
refactoring: Updating allowed values for ASCOR countries attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Dec 1, 2023
1 parent 6d7f1d3 commit 8815b10
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 37 deletions.
11 changes: 5 additions & 6 deletions app/models/ascor/country.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ class ASCOR::Country < ApplicationRecord
'North America',
'Oceania'
].freeze
LENDING_GROUPS = [
'High-income economies',
'Upper-middle-income economies',
'Lower-middle-income economies'
].freeze
LENDING_GROUPS = %w[High-income Upper-middle-income Lower-middle-income Low-income].freeze
MONITOR_CATEGORIES = [
'Advanced economies',
'Emerging market economies',
'Low-income developing countries'
].freeze
TYPE_OF_PARTY = [
'Annex I',
'Non-Annex I'
'Non-Annex I',
'Annex I and Annex II',
'Non-Annex I and Non-Annex II',
'Annex I and Non-Annex II'
].freeze
DEFAULT_COUNTRIES = %w[USA CAN GBR FRA DEU ITA JPN RUS].freeze

Expand Down
50 changes: 25 additions & 25 deletions db/seeds/tpi/ascor_countries.csv
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
Id,Name,Country ISO code,Region,World Bank lending group,International Monetary Fund fiscal monitor category,Type of Party to the United Nations Framework Convention on Climate Change
1,United States,USA,North America,High-income economies,Advanced economies,Annex I
2,Japan,JPN,Asia,High-income economies,Advanced economies,Annex I
3,France,FRA,Europe,High-income economies,Advanced economies,Annex I
4,Italy,ITA,Europe,High-income economies,Advanced economies,Annex I
5,Egypt,EGY,Africa,Lower-middle-income economies,Emerging market economies,Non-Annex I
6,Uruguay,URY,Latin America and Caribbean,High-income economies,Emerging market economies,Non-Annex I
7,Saudi Arabia,SAU,Asia,High-income economies,Emerging market economies,Non-Annex I
8,Australia,AUS,Oceania,High-income economies,Advanced economies,Annex I
9,Mexico,MEX,Latin America and Caribbean,Upper-middle-income economies,Emerging market economies,Non-Annex I
10,China,CHN,Asia,Upper-middle-income economies,Emerging market economies,Non-Annex I
11,Poland,POL,Europe,High-income economies,Emerging market economies,Annex I
12,Indonesia,IDN,Asia,Upper-middle-income economies,Emerging market economies,Non-Annex I
13,Kazakhstan,KAZ,Asia,Upper-middle-income economies,Emerging market economies,Non-Annex I
14,Canada,CAN,North America,High-income economies,Advanced economies,Annex I
15,Thailand,THA,Asia,Upper-middle-income economies,Emerging market economies,Non-Annex I
16,Chile,CHL,Latin America and Caribbean,High-income economies,Emerging market economies,Non-Annex I
17,South Africa,ZAF,Africa,Upper-middle-income economies,Emerging market economies,Non-Annex I
18,Brazil,BRA,Latin America and Caribbean,Upper-middle-income economies,Emerging market economies,Non-Annex I
19,Kenya,KEN,Africa,Lower-middle-income economies,Low-income developing countries,Non-Annex I
20,Morocco,MAR,Africa,Lower-middle-income economies,Emerging market economies,Non-Annex I
21,Germany,DEU,Europe,High-income economies,Advanced economies,Annex I
22,United Kingdom,GBR,Europe,High-income economies,Advanced economies,Annex I
23,India,IND,Asia,Lower-middle-income economies,Emerging market economies,Non-Annex I
24,Barbados,BRB,Latin America and Caribbean,High-income economies,Emerging market economies,Non-Annex I
25,Bangladesh,BGD,Asia,Lower-middle-income economies,Low-income developing countries,Non-Annex I
1,United States,USA,North America,High-income,Advanced economies,Annex I
2,Japan,JPN,Asia,High-income,Advanced economies,Annex I
3,France,FRA,Europe,High-income,Advanced economies,Annex I
4,Italy,ITA,Europe,High-income,Advanced economies,Annex I
5,Egypt,EGY,Africa,Lower-middle-income,Emerging market economies,Non-Annex I
6,Uruguay,URY,Latin America and Caribbean,High-income,Emerging market economies,Non-Annex I
7,Saudi Arabia,SAU,Asia,High-income,Emerging market economies,Non-Annex I
8,Australia,AUS,Oceania,High-income,Advanced economies,Annex I
9,Mexico,MEX,Latin America and Caribbean,Upper-middle-income,Emerging market economies,Non-Annex I
10,China,CHN,Asia,Upper-middle-income,Emerging market economies,Non-Annex I
11,Poland,POL,Europe,High-income,Emerging market economies,Annex I
12,Indonesia,IDN,Asia,Upper-middle-income,Emerging market economies,Non-Annex I
13,Kazakhstan,KAZ,Asia,Upper-middle-income,Emerging market economies,Non-Annex I
14,Canada,CAN,North America,High-income,Advanced economies,Annex I
15,Thailand,THA,Asia,Upper-middle-income,Emerging market economies,Non-Annex I
16,Chile,CHL,Latin America and Caribbean,High-income,Emerging market economies,Non-Annex I
17,South Africa,ZAF,Africa,Upper-middle-income,Emerging market economies,Non-Annex I
18,Brazil,BRA,Latin America and Caribbean,Upper-middle-income,Emerging market economies,Non-Annex I
19,Kenya,KEN,Africa,Lower-middle-income,Low-income developing countries,Non-Annex I
20,Morocco,MAR,Africa,Lower-middle-income,Emerging market economies,Non-Annex I
21,Germany,DEU,Europe,High-income,Advanced economies,Annex I
22,United Kingdom,GBR,Europe,High-income,Advanced economies,Annex I
23,India,IND,Asia,Lower-middle-income,Emerging market economies,Non-Annex I
24,Barbados,BRB,Latin America and Caribbean,High-income,Emerging market economies,Non-Annex I
25,Bangladesh,BGD,Asia,Lower-middle-income,Low-income developing countries,Non-Annex I
Binary file modified db/test-dump.psql
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/commands/csv_data_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@
country = ASCOR::Country.find_by(iso: 'JPN')
expect(country.name).to eq('Japan')
expect(country.region).to eq('Asia')
expect(country.wb_lending_group).to eq('High-income economies')
expect(country.wb_lending_group).to eq('High-income')
expect(country.fiscal_monitor_category).to eq('Advanced economies')
expect(country.type_of_party).to eq('Annex I')
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/ascor_countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
name { 'United States' }
iso { 'USA' }
region { 'North America' }
wb_lending_group { 'High-income economies' }
wb_lending_group { 'High-income' }
fiscal_monitor_category { 'Advanced economies' }
type_of_party { 'Annex I' }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "United States",
"Country ISO code": "USA",
"Region": "North America",
"World Bank lending group": "High-income economies",
"World Bank lending group": "High-income",
"International Monetary Fund fiscal monitor category": "Advanced economies",
"Type of Party to the United Nations Framework Convention on Climate Change": "Annex I"
}
Expand Down
4 changes: 2 additions & 2 deletions spec/support/fixtures/files/ascor_countries.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Id,Name,Country ISO code,Region,World Bank lending group,International Monetary Fund fiscal monitor category,Type of Party to the United Nations Framework Convention on Climate Change
,United States,USA,North America,High-income economies,Advanced economies,Annex I
,Japan,JPN,Asia,High-income economies,Advanced economies,Annex I
,United States,USA,North America,High-income,Advanced economies,Annex I
,Japan,JPN,Asia,High-income,Advanced economies,Annex I
2 changes: 1 addition & 1 deletion spec/system/public/tpi/ascor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
expect(page).to have_text('Region')
expect(page).to have_text('Asia')
expect(page).to have_text('World Bank lending group')
expect(page).to have_text('High-income economies')
expect(page).to have_text('High-income')
expect(page).to have_text('IMF Fiscal Monitor Category')
expect(page).to have_text('Advanced economies')
expect(page).to have_text('Type of Party to the UNFCCC')
Expand Down

0 comments on commit 8815b10

Please sign in to comment.