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

Prod release #481

Merged
merged 137 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
e0bb6f1
feat: adding beta_mq_assessments? to company model
martintomas Sep 5, 2023
583c6fe
Disable BETA button and add tooltip for companies lacking data
Bluesmile82 Sep 7, 2023
4d6dfd3
fix: of other views using mq_beta_scores partial
martintomas Sep 8, 2023
22d9d16
fix: show tooltip only when there are no MQ BETA data
martintomas Sep 8, 2023
115c38c
Merge pull request #439 from Vizzuality/feat/company-doesnt-have-mq-b…
martintomas Sep 8, 2023
eb1668b
feat: ASCOR Countries model
martintomas Sep 12, 2023
9109e68
feat: ASCOR Benchmarks model
martintomas Sep 12, 2023
5faf849
feat: ASCOR Pathways model
martintomas Sep 14, 2023
770a02c
feat: ASCOR Assessment indicators model
martintomas Sep 14, 2023
22067a8
feat: ASCOR Assessments model
martintomas Sep 15, 2023
c625cdd
feat: Basic skeleton of ASCOR page
martintomas Sep 18, 2023
d3958d3
fix: update brakeman warning list
martintomas Sep 18, 2023
686fcac
refactoring: Renaming sovereign_bonds_issuers to ascor
martintomas Sep 19, 2023
1974573
Merge pull request #443 from Vizzuality/feat/ascor-models
martintomas Sep 19, 2023
1109d9a
refactoring: ASCOR countries model
martintomas Sep 20, 2023
6d499e1
refactoring: ASCOR benchmarks model
martintomas Sep 20, 2023
16c005a
refactoring: ASCOR assessment indicators model
martintomas Sep 20, 2023
ccc8461
refactoring: ASCOR assessments model
martintomas Sep 20, 2023
c7951dc
refactoring: ASCOR pathways model
martintomas Sep 21, 2023
4c42b14
Merge pull request #444 from Vizzuality/refactoring/ascor-models
martintomas Sep 21, 2023
b72c7f4
feat: Export ASCOR indicators
martintomas Sep 25, 2023
b52a5d4
feat: Export ASCOR assessments
martintomas Sep 25, 2023
3046d4f
feat: Export ASCOR countries
martintomas Sep 25, 2023
e17d1fe
feat: Export ASCOR benchmarks
martintomas Sep 25, 2023
efac018
feat: Export ASCOR pathways
martintomas Sep 25, 2023
14635d8
Merge pull request #445 from Vizzuality/feature/ascor-exports
martintomas Sep 25, 2023
f4b11cb
Merge branch 'feat/allow-to-hide-bank-assessment-results' into develop
martintomas Sep 26, 2023
daae0e9
Merge branch 'feat/mark-bank-indicator-as-placeholder' into develop
martintomas Sep 27, 2023
ee225b3
feat: ASCOR layer
martintomas Sep 27, 2023
9ead60f
Merge pull request #448 from Vizzuality/feat/ascor-layout
martintomas Sep 27, 2023
aee7cee
feat: ASCOR bubble chart data
martintomas Oct 2, 2023
a2e9d58
Merge pull request #449 from Vizzuality/feature/ascor-bubble-chart-api
martintomas Oct 2, 2023
e947b33
test: use match_array instead of eq
martintomas Oct 2, 2023
07b8224
feat: ASCOR emissions chart data
martintomas Oct 3, 2023
3640d52
Merge pull request #450 from Vizzuality/feature/ascor-emissions-chart…
martintomas Oct 3, 2023
8041456
Create countries bubble chart
barbara-chaves Oct 4, 2023
072cac2
feat: ASCOR assessments results per country
martintomas Oct 4, 2023
d7230fb
refactoring: removing TODOs and renaming ascor bubble chart folder
martintomas Oct 5, 2023
6e09a32
Review fixes
barbara-chaves Oct 5, 2023
c0b162c
feat: Rest of the styles
martintomas Oct 5, 2023
4990e5c
Merge pull request #451 from Vizzuality/client/feature/LSE-124-fe-bub…
martintomas Oct 5, 2023
8994a0c
Merge branch 'develop' into feature/ascor-assessment-results
martintomas Oct 5, 2023
46a897c
fix of descriptions
martintomas Oct 5, 2023
fdc2279
Merge pull request #452 from Vizzuality/feature/ascor-assessment-results
martintomas Oct 5, 2023
a168614
feat: Calculate ASCOR recent emissions
martintomas Oct 6, 2023
53f4a19
Merge pull request #453 from Vizzuality/feat/ascor-recent-emissions
martintomas Oct 6, 2023
8761f0d
feat: Adding modals with info to ASCOR All countries page
martintomas Oct 6, 2023
59b7f92
refactoring: ASCOR cap groups are quantiles
martintomas Oct 9, 2023
a3a752a
Merge pull request #454 from Vizzuality/feat/ascor-modal-infos
martintomas Oct 9, 2023
b1343bf
Add filters
barbara-chaves Oct 5, 2023
1cd8ee8
Update countries bubble chart colors and toootip
barbara-chaves Oct 9, 2023
937c231
Merge pull request #456 from Vizzuality/client/feature/update-countri…
martintomas Oct 10, 2023
9566a99
refactoring: Updating ASCOR icons and making assessments responsive
martintomas Oct 10, 2023
0a0a9e1
Merge branch 'client/feature/LSE-128-fe-emissions-graph-all-countries…
martintomas Oct 10, 2023
0404f4d
feat: React component to generate metrics_ep1a filters
martintomas Oct 10, 2023
dd5d078
test: which verifies that EP.1.a.i metric is rendered
martintomas Oct 10, 2023
2ce097f
Merge pull request #455 from Vizzuality/client/feature/LSE-128-fe-emi…
martintomas Oct 10, 2023
75de4aa
Merge branch 'develop' into feat/ascor-assessment-filters
martintomas Oct 10, 2023
27cfb52
Add chart responsivity, update country selector
barbara-chaves Oct 11, 2023
059b338
fix: ASCOR emissions chart API url
martintomas Oct 12, 2023
129ac7f
Merge pull request #458 from Vizzuality/client/feature/ascor-emission…
martintomas Oct 12, 2023
057ba05
Update app/javascript/components/tpi/AscorRecentEmissions.js
martintomas Oct 12, 2023
e0c8f4e
Update app/javascript/components/tpi/AscorRecentEmissions.js
martintomas Oct 12, 2023
f3246fc
Update app/assets/stylesheets/tpi/pages/ascor.scss
martintomas Oct 12, 2023
a0a2390
Merge branch 'develop' into feat/ascor-assessment-filters
martintomas Oct 12, 2023
e577ac2
Merge pull request #457 from Vizzuality/feat/ascor-assessment-filters
martintomas Oct 12, 2023
19e5e05
fix: ASCOR BubbleChart service
martintomas Oct 12, 2023
dbeedbd
feat: React component for ASCOR country selector
martintomas Oct 12, 2023
fd89003
Merge pull request #459 from Vizzuality/feature/ascor-country-combobox
martintomas Oct 12, 2023
66cbfd3
refactoring: Updating styles of ASCOR pages based on feedback
martintomas Oct 13, 2023
e9597e2
fix: Styles of ASCOR assessment - position of Source
martintomas Oct 13, 2023
f9654f4
Merge branch 'master' into develop
martintomas Oct 16, 2023
1f27a09
Merge branch 'master' into develop
martintomas Oct 17, 2023
c8584c5
feat: LinkedIn widget for homepage
martintomas Oct 17, 2023
22512e7
Add mobile version of the countries emissions bubble chart
barbara-chaves Oct 17, 2023
3dd6305
Merge branch 'develop' into client/feature/LSE-126-mobile-version-of-…
martintomas Oct 17, 2023
5ef5b88
test: Fix of ASCOR bubble chart test (desktop and mobile version)
martintomas Oct 17, 2023
cb8b5ca
Merge pull request #461 from Vizzuality/client/feature/LSE-126-mobile…
barbara-chaves Oct 18, 2023
eb3235f
Merge branch 'develop' into feature/separate-publication-page
martintomas Oct 19, 2023
36fb613
Merge pull request #462 from Vizzuality/feature/separate-publication-…
martintomas Oct 19, 2023
28f2c6a
Merge branch 'develop' into feature/separate-publication-page
martintomas Oct 23, 2023
331816e
Merge pull request #463 from Vizzuality/feature/separate-publication-…
martintomas Oct 23, 2023
b229dd2
Merge branch 'master' into develop
martintomas Oct 24, 2023
3049143
Merge branch 'develop' into feature/linkedin-widget
martintomas Oct 24, 2023
c275d24
Merge pull request #466 from Vizzuality/feature/linkedin-widget
martintomas Oct 24, 2023
8dea066
feat: Adding active filter into Company Admin
martintomas Oct 24, 2023
395ae05
Add min Y axis value and change X axis ticks
barbara-chaves Oct 30, 2023
7c3d897
Change countries sizes range
barbara-chaves Oct 31, 2023
798b8d6
Update axis ticks
barbara-chaves Oct 31, 2023
7a1143c
Merge pull request #469 from Vizzuality/client/feature/LSE-140-fe-bub…
barbara-chaves Oct 31, 2023
96fbb94
Typo fixing and remove text from contact section
barbara-chaves Nov 2, 2023
8f69b88
Merge pull request #470 from Vizzuality/client/feature/LSE-142-fe-oth…
barbara-chaves Nov 2, 2023
9d87dc6
Merge pull request #468 from Vizzuality/client/feature/LSE-141-fe-cou…
barbara-chaves Nov 6, 2023
f927a16
refactoring: Update of seeding data plus fix of units
martintomas Nov 6, 2023
54c46e6
feat: Adding research notes to ASCOR assessment model
martintomas Nov 7, 2023
28fad1e
Merge pull request #471 from Vizzuality/feat/ascor-research-notes
martintomas Nov 7, 2023
d6f8535
Merge pull request #472 from Vizzuality/master
martintomas Nov 7, 2023
be852f4
feat: Render metrics for areas which don't have any indicators
martintomas Nov 8, 2023
dc442df
Merge pull request #473 from Vizzuality/feat/ascor-render-metrics-wit…
martintomas Nov 8, 2023
96e8120
refactoring: Renaming trend filter values and reversing ordering
martintomas Nov 8, 2023
b5bece9
refactoring: ASCOR recent emission value is string
martintomas Nov 8, 2023
b9fb8d0
refactoring: ASCOR assessment legend is always visible
martintomas Nov 8, 2023
bab7b08
refactoring: Changing couple ASCOR graph descriptions
martintomas Nov 8, 2023
6829793
test: Updating tests with new sql dump
martintomas Nov 8, 2023
c381086
refactoring: Adding new bubble sizes to ASCOR tool
martintomas Nov 9, 2023
fec7123
feat: Service which calculates data for EP.2 chart
martintomas Nov 9, 2023
aed0c22
Merge pull request #474 from Vizzuality/refactoring/ascor-four-bubble…
barbara-chaves Nov 16, 2023
a37623d
Bubble chart fixes
barbara-chaves Nov 16, 2023
d154069
Add bubble size to tooltip
barbara-chaves Nov 16, 2023
e1b638a
Revert db structure.sql change
barbara-chaves Nov 17, 2023
b906857
Merge pull request #476 from Vizzuality/feature/LSE-140
barbara-chaves Nov 17, 2023
c8548ef
Merge pull request #475 from Vizzuality/feature/ascor-benchmarks-chart
barbara-chaves Nov 17, 2023
0c96c2c
Countries emissions chart fixes
barbara-chaves Nov 17, 2023
2dcac9b
Merge pull request #477 from Vizzuality/client/feature/LSE-145-fe-cha…
barbara-chaves Nov 17, 2023
aec8d77
Update green buttons
barbara-chaves Nov 17, 2023
5316fd6
fix ascor.scss
barbara-chaves Nov 17, 2023
da64870
Merge pull request #478 from Vizzuality/client/feature/LSE-152-fe-cha…
barbara-chaves Nov 17, 2023
0c0f510
feat: Possibility to show/hide ASCOR pillar assessments
martintomas Nov 20, 2023
a982f24
feat: Show box with ASCOR country details
martintomas Nov 20, 2023
daf78e3
Fix title position
barbara-chaves Nov 21, 2023
8e58eb8
Add country benchmarks chart
barbara-chaves Nov 22, 2023
120617d
Merge pull request #479 from Vizzuality/client/fix/LSE-137-bubble-cha…
barbara-chaves Nov 22, 2023
ea2e053
feat: Wrapping ASCOR benchmarks chart at metric styles
martintomas Nov 22, 2023
228c3ea
Merge pull request #480 from Vizzuality/client/LSE-156-fe-new-time-se…
martintomas Nov 22, 2023
5eda99d
refactoring: Readjusting country emissions pathway description
martintomas Nov 27, 2023
5867a9f
refactoring: Update ASCOR methodology image size
martintomas Nov 27, 2023
a659a69
refactoring: Renaming Renewable Opportunities to Renewable Energy Opp…
martintomas Nov 27, 2023
6ae3c1c
fix: Typo in Exempt ASCOR category
martintomas Nov 27, 2023
ce3da15
refactoring: Remove pillar show/hide areas option
martintomas Nov 27, 2023
66b6a84
refactoring: Reposition items inside ASCOR country box
martintomas Nov 28, 2023
edb07e3
refactoring: Minor styles refactoring of ASCOR pages
martintomas Nov 29, 2023
6d7f1d3
test: Fixing ASCOR system tests
martintomas Nov 29, 2023
8815b10
refactoring: Updating allowed values for ASCOR countries attributes
martintomas Dec 1, 2023
66290ed
refactoring: Renaming ASCOR item at dropdown menu
martintomas Dec 4, 2023
8c3cc45
fix: Remove Bank reference from ASCOR dropdown
martintomas Dec 6, 2023
55cdf50
fix: ASCOR pathways importer so No data text is respected
martintomas Dec 6, 2023
c805bcf
refactoring: ASCOR benchmark chart Y axis always starts at 0
martintomas Dec 6, 2023
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
58 changes: 58 additions & 0 deletions app/admin/ascor/assessment_indicators.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ActiveAdmin.register ASCOR::AssessmentIndicator do
config.sort_order = 'id_asc'

menu label: 'Assessment Indicators', parent: 'ASCOR', priority: 4

actions :all, except: [:new, :create]

filter :code
filter :text
filter :indicator_type, as: :check_boxes, collection: ASCOR::AssessmentIndicator::INDICATOR_TYPES

data_export_sidebar 'ASCORAssessmentIndicators', display_name: 'ASCOR AssessmentIndicators'

permit_params :code, :indicator_type, :text

show do
attributes_table do
row :id
row :code
row :indicator_type
row :text
row :units_or_response_type
row :created_at
row :updated_at
end

active_admin_comments
end

form html: {'data-controller' => 'check-modified'} do |f|
f.semantic_errors(*f.object.errors.keys)

f.inputs do
f.input :indicator_type, as: :select, collection: ASCOR::AssessmentIndicator::INDICATOR_TYPES
f.input :code
f.input :text
f.input :units_or_response_type
end

f.actions
end

index do
id_column
column :indicator_type
column :code
column :text
actions
end

csv do
column :id
column :type, &:indicator_type
column :code
column :text
column :units_or_response_type
end
end
101 changes: 101 additions & 0 deletions app/admin/ascor/assessments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
ActiveAdmin.register ASCOR::Assessment do
config.sort_order = 'assessment_date_desc'
includes :country

menu label: 'Assessments', parent: 'ASCOR', priority: 5

permit_params :country_id, :assessment_date, :publication_date, :notes,
results_attributes: [:id, :assessment_id, :indicator_id, :answer, :source, :year, :_destroy]

filter :country
filter :assessment_date, as: :select

data_export_sidebar 'ASCORAssessments', display_name: 'ASCOR Assessments'

index do
selectable_column
id_column
column :country, sortable: 'ascor_countries.name'
column :assessment_date
column :publication_date

actions
end

show do
attributes_table do
row :id
row :country
row :assessment_date
row :publication_date
row 'Research Notes', &:notes
row :created_at
row :updated_at
end

panel 'Assessment Results' do
table_for resource.results.includes(:indicator).order(:indicator_id) do
column(:indicator)
column(:answer)
column(:source)
column(:year)
end
end

active_admin_comments
end

form do |f|
f.semantic_errors(*f.object.errors.keys)

f.inputs do
f.input :country, as: :select, collection: ASCOR::Country.all.order(:name)
f.input :assessment_date, as: :datepicker
f.input :publication_date, as: :datepicker
f.input :notes, label: 'Research Notes'
end

f.has_many :results, allow_destroy: true, heading: false do |ff|
ff.inputs 'Assessment Results' do
ff.input :indicator, as: :select, collection: ASCOR::AssessmentIndicator.all.order(:code)
ff.input :answer
ff.input :source
ff.input :year
end
end

f.actions
end

csv do
column :id
column :country do |resource|
resource.country.name
end
column :assessment_date
column :publication_date
ASCOR::AssessmentIndicator.where.not(indicator_type: 'pillar')
.where.not(code: %w[EP.1.a.i EP.1.a.ii]).order(:id).all.each do |indicator|
column "#{indicator.indicator_type} #{indicator.code}", humanize_name: false do |resource|
controller.assessment_results[[resource.id, indicator.id]]&.first&.answer
end
end
ASCOR::AssessmentIndicator.where(indicator_type: %w[indicator metric]).order(:id).all.each do |indicator|
column "source #{indicator.indicator_type} #{indicator.code}", humanize_name: false do |resource|
controller.assessment_results[[resource.id, indicator.id]]&.first&.source
end
end
ASCOR::AssessmentIndicator.where(indicator_type: 'metric').order(:id).all.each do |indicator|
column "year #{indicator.indicator_type} #{indicator.code}", humanize_name: false do |resource|
controller.assessment_results[[resource.id, indicator.id]]&.first&.year
end
end
column 'Research Notes', &:notes
end

controller do
def assessment_results
@assessment_results ||= ASCOR::AssessmentResult.all.group_by { |r| [r.assessment_id, r.indicator_id] }
end
end
end
88 changes: 88 additions & 0 deletions app/admin/ascor/benchmarks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
ActiveAdmin.register ASCOR::Benchmark do
config.sort_order = 'country_id_asc'
includes :country

menu label: 'Benchmarks', parent: 'ASCOR', priority: 2

permit_params :country_id, :publication_date, :emissions_metric, :emissions_boundary, :units, :benchmark_type, :emissions

filter :country, as: :select, collection: -> { ASCOR::Country.all.order(:name) }
filter :emissions_metric, as: :select, collection: -> { ASCOR::EmissionsMetric::VALUES }
filter :emissions_boundary, as: :select, collection: -> { ASCOR::EmissionsBoundary::VALUES }
filter :benchmark_type, as: :select, collection: -> { ASCOR::BenchmarkType::VALUES }

data_export_sidebar 'ASCORBenchmarks', display_name: 'ASCOR Benchmarks'

index do
selectable_column
id_column
column :country, sortable: 'ascor_countries.name'
column :emissions_metric
column :emissions_boundary
column :units
column :benchmark_type

actions
end

show do
attributes_table do
row :id
row :country
row :publication_date
row :emissions_metric
row :emissions_boundary
row :units
row :benchmark_type
row :created_at
row :updated_at
end

panel 'Benchmark emission values' do
render 'admin/cp/emissions_table', emissions: resource.emissions
end

active_admin_comments
end

form html: {'data-controller' => 'check-modified with-emission-table-form'} do |f|
f.semantic_errors(*f.object.errors.keys)

f.inputs do
f.input :country, as: :select, collection: ASCOR::Country.all.order(:name)
f.input :publication_date, as: :datepicker
f.input :emissions_metric, as: :select, collection: ASCOR::EmissionsMetric::VALUES
f.input :emissions_boundary, as: :select, collection: ASCOR::EmissionsBoundary::VALUES
f.input :units
f.input :benchmark_type, as: :select, collection: ASCOR::BenchmarkType::VALUES
f.input :emissions, as: :hidden, input_html: {value: f.object.emissions.to_json, id: 'input_emissions'}
end

div class: 'panel' do
h3 'Benchmark emission values'
div class: 'panel-contents padding-20' do
render 'admin/cp/emissions_table_edit', f: f
end
end

f.actions
end

csv do
year_columns = ASCOR::Benchmark.select(:emissions).flat_map(&:emissions_all_years).uniq.sort

column :id
column(:country) { |b| b.country.name }
column(:publication_date) { |b| b.publication_date.to_s(:year_month) }
column :emissions_metric
column :emissions_boundary
column :units
column :benchmark_type

year_columns.map do |year|
column year do |benchmark|
benchmark.emissions[year]
end
end
end
end
65 changes: 65 additions & 0 deletions app/admin/ascor/countries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ActiveAdmin.register ASCOR::Country do
config.batch_actions = false
config.sort_order = 'name_asc'

menu label: 'Countries', parent: 'ASCOR', priority: 1

permit_params :name, :iso, :region, :wb_lending_group, :fiscal_monitor_category, :type_of_party

filter :iso_contains, label: 'ISO'
filter :name_contains, label: 'Name'
filter :region, as: :check_boxes, collection: proc { Geography::REGIONS }

data_export_sidebar 'ASCORCountries', display_name: 'ASCOR Countries'

index do
selectable_column
id_column
column :name
column 'Country ISO code', :iso
column :region

actions
end

show do
attributes_table do
row :id
row :name
row 'Country ISO code', &:iso
row :region
row 'World Bank lending group', &:wb_lending_group
row 'International Monetary Fund fiscal monitor category', &:fiscal_monitor_category
row 'Type of Party to the United Nations Framework Convention on Climate Change', &:type_of_party
end

active_admin_comments
end

form do |f|
semantic_errors(*f.object.errors.attribute_names)

f.inputs do
f.input :name
f.input :iso, label: 'Country ISO code'
f.input :region, as: :select, collection: ASCOR::Country::REGIONS
f.input :wb_lending_group, as: :select, collection: ASCOR::Country::LENDING_GROUPS, label: 'World Bank lending group'
f.input :fiscal_monitor_category, as: :select, collection: ASCOR::Country::MONITOR_CATEGORIES,
label: 'International Monetary Fund fiscal monitor category'
f.input :type_of_party, as: :select, collection: ASCOR::Country::TYPE_OF_PARTY,
label: 'Type of Party to the United Nations Framework Convention on Climate Change'
end

f.actions
end

csv do
column :id
column :name
column 'Country ISO code', humanize_name: false, &:iso
column :region
column 'World Bank lending group', humanize_name: false, &:wb_lending_group
column 'International Monetary Fund fiscal monitor category', humanize_name: false, &:fiscal_monitor_category
column 'Type of Party to the United Nations Framework Convention on Climate Change', humanize_name: false, &:type_of_party
end
end
Loading
Loading