Skip to content

Commit

Permalink
Merge pull request #482 from Vizzuality/develop
Browse files Browse the repository at this point in the history
Prod release - minor ASCOR fixes
  • Loading branch information
martintomas authored Dec 7, 2023
2 parents 88dbbbd + 25b6e6c commit a7e49f2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/controllers/tpi/ascor_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class ASCORController < TPIController

def index
@assessment_dates = ASCOR::Assessment.pluck(:assessment_date).uniq
@publications_and_articles = TPISector.find_by(slug: 'ascor')&.publications_and_articles || []
@publications_and_articles = (
Publication.joins(:tags).includes(:tpi_sectors).where(tags: {name: 'ASCOR'}) +
NewsArticle.joins(:tags).where(tags: {name: 'ASCOR'})
).uniq.sort_by(&:publication_date).reverse!.take(3)
ascor_page = TPIPage.find_by(slug: 'ascor')
@methodology_description = Content.find_by(page: ascor_page, code: 'methodology_description')
@methodology_id = Content.find_by(page: ascor_page, code: 'methodology_publication_id')
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/components/tpi/charts/ascor-bubble/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ const getTooltipText = ({ tooltipContent }) => {
return `
<div>
<p class="bubble-tip-header">${tooltipContent.header}</p>
<p class="bubble-tip-text">${tooltipContent.emission_size}</p>
</div>
`;
}
Expand Down Expand Up @@ -241,7 +240,7 @@ BubbleChart.propTypes = {
results: PropTypes.arrayOf(
PropTypes.shape({
area: PropTypes.string.isRequired,
market_cap_group: PropTypes.string.isRequired,
market_cap_group: PropTypes.number.isRequired,
country_id: PropTypes.number.isRequired,
country_path: PropTypes.string.isRequired,
country_name: PropTypes.string.isRequired,
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20231207082211_remove_ascor_sector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveASCORSector < ActiveRecord::Migration[6.1]
def change
TPISector.find_by(slug: 'ascor')&.destroy
end
end
3 changes: 2 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4163,6 +4163,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230927112905'),
('20231023101859'),
('20231023120255'),
('20231108125346');
('20231108125346'),
('20231207082211');


Binary file modified db/test-dump.psql
Binary file not shown.
6 changes: 6 additions & 0 deletions spec/system/public/tpi/ascor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

describe 'ASCOR', type: 'system', site: 'tpi' do
describe 'all countries page' do
let!(:publication) { create(:publication, tpi_sectors: [], tags: [create(:keyword, name: 'ASCOR')]) }

before do
visit '/ascor'
end
Expand Down Expand Up @@ -31,6 +33,10 @@
expect(page).to have_text('CF 1. International Climate Finance')
end
end

it 'shows the publication' do
expect(page).to have_text(publication.title)
end
end

describe 'single country page' do
Expand Down

0 comments on commit a7e49f2

Please sign in to comment.