-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from Vizzuality/feature/no-of-assessments-chart
Feature/ 'assessments levels over the years' chart
- Loading branch information
Showing
11 changed files
with
133 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
module TPI | ||
class CompaniesController < ApplicationController | ||
before_action :fetch_company | ||
|
||
def show | ||
@company = Company.find(params[:id]) | ||
@company_summary = company_presenter.summary | ||
@company_mq_assessments = company_presenter.mq_assessments | ||
end | ||
|
||
# Data: Company MQ Assessments Levels over the years | ||
# Section: MQ | ||
# Type: line chart | ||
# On pages: :show | ||
def assessments_levels_chart_data | ||
data = ::Api::Charts::Company.new(@company).assessments_levels_data | ||
|
||
@company_details = ::Api::Presenters::Company.new(@company).company_details | ||
render json: data.chart_json | ||
end | ||
|
||
# Data: Company emissions | ||
# Section: CP | ||
# Type: line chart | ||
# On pages: :show | ||
def emissions_chart_data | ||
@company = Company.find(params[:id]) | ||
|
||
data = ::Api::Charts::Company.new(@company).emissions_data | ||
|
||
render json: data.chart_json | ||
end | ||
|
||
private | ||
|
||
def company_presenter | ||
@company_presenter ||= ::Api::Presenters::Company.new(@company) | ||
end | ||
|
||
def fetch_company | ||
@company = Company.friendly.find(params[:id]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters