Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3429 from ONRR/3248-fiscal-year-label
Browse files Browse the repository at this point in the history
Added the calculated fiscal and calendar years to the display drop down
  • Loading branch information
brentryanjohnson authored Nov 30, 2018
2 parents 8692400 + 5fe7502 commit 4163493
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ url: https://revenuedata.doi.gov

# app version number

version: v4.2.1
version: v4.2.2

exclude:
# top-level log
Expand Down
2 changes: 1 addition & 1 deletion gatsby-site/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
siteMetadata: {
title: 'Natural Resources Revenue Data',
description: 'This site provides open data about natural resource management on federal lands and waters in the United States, including oil, gas, coal, and other extractive industries.',
version: 'v4.2.1',
version: 'v4.2.2',
googleAnalyticsId: GOOGLE_ANALYTICS_ID,
},
plugins: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const CHART_STYLE_MAP = {

const MAX_CHART_BAR_SIZE = 15;

const PRODUCTION_VOLUMES_FISCAL_YEAR = "ProductionVolumesFiscalYear";
const PRODUCTION_VOLUMES_CALENDAR_YEAR = "ProductionVolumesCalendarYear";
const REVENUES_FISCAL_YEAR = "RevenuesFiscalYear";
const REVENUES_CALENDAR_YEAR = "RevenuesCalendarYear";

class KeyStatsSection extends React.Component{

constructor(props){
Expand Down Expand Up @@ -170,10 +175,10 @@ class KeyStatsSection extends React.Component{
name:"Most recent 12 months",
default: (this.state.productionPeriod === DROPDOWN_VALUES.Recent)},
{key:DROPDOWN_VALUES.Fiscal,
name:"Fiscal year 2017",
name:"Fiscal year "+this.state[PRODUCTION_VOLUMES_FISCAL_YEAR][CONSTANTS.PRODUCTION_VOLUMES_OIL_KEY],
default: (this.state.productionPeriod === DROPDOWN_VALUES.Fiscal)},
{key:DROPDOWN_VALUES.Calendar,
name:"Calendar year 2017",
name:"Calendar year "+this.state[PRODUCTION_VOLUMES_CALENDAR_YEAR][CONSTANTS.PRODUCTION_VOLUMES_OIL_KEY],
default: (this.state.productionPeriod === DROPDOWN_VALUES.Calendar)}]}></DropDown>
</div>
}
Expand Down Expand Up @@ -280,10 +285,10 @@ class KeyStatsSection extends React.Component{
name:"Most recent 12 months",
default: (this.state.revenuePeriod === DROPDOWN_VALUES.Recent)},
{key:DROPDOWN_VALUES.Fiscal,
name:"Fiscal year 2017",
name:"Fiscal year "+this.state[REVENUES_FISCAL_YEAR][CONSTANTS.REVENUES_ALL_KEY],
default: (this.state.revenuePeriod === DROPDOWN_VALUES.Fiscal)},
{key:DROPDOWN_VALUES.Calendar,
name:"Calendar year 2017",
name:"Calendar year "+this.state[REVENUES_CALENDAR_YEAR][CONSTANTS.REVENUES_ALL_KEY],
default: (this.state.revenuePeriod === DROPDOWN_VALUES.Calendar)}]}></DropDown>
</div>
}
Expand Down Expand Up @@ -380,6 +385,10 @@ export default connect(
[CONSTANTS.PRODUCTION_VOLUMES_COAL_KEY]: state[CONSTANTS.PRODUCTION_VOLUMES_KEY][CONSTANTS.PRODUCTION_VOLUMES_COAL_KEY],
[CONSTANTS.REVENUES_ALL_KEY]: state[CONSTANTS.REVENUES_KEY][CONSTANTS.REVENUES_ALL_KEY],
[CONSTANTS.DISBURSEMENTS_ALL_KEY]: state[CONSTANTS.DISBURSEMENTS_KEY][CONSTANTS.DISBURSEMENTS_ALL_KEY],
[PRODUCTION_VOLUMES_FISCAL_YEAR]: state[CONSTANTS.PRODUCTION_VOLUMES_KEY][CONSTANTS.FISCAL_YEAR_KEY],
[PRODUCTION_VOLUMES_CALENDAR_YEAR]: state[CONSTANTS.PRODUCTION_VOLUMES_KEY][CONSTANTS.CALENDAR_YEAR_KEY],
[REVENUES_FISCAL_YEAR]: state[CONSTANTS.REVENUES_KEY][CONSTANTS.FISCAL_YEAR_KEY],
[REVENUES_CALENDAR_YEAR]: state[CONSTANTS.REVENUES_KEY][CONSTANTS.CALENDAR_YEAR_KEY],
}),
dispatch => ({ productionVolumesByYear: (key, filter) => dispatch(productionVolumesByYearAction(key, filter)),
productionVolumesByMonth: (key, filter) => dispatch(productionVolumesByMonthAction(key, filter)),
Expand Down
3 changes: 3 additions & 0 deletions gatsby-site/src/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module.exports = Object.freeze({
REVENUES_KEY: 'revenues',
PRODUCTION_VOLUMES_KEY: 'productionVolumes',
DISBURSEMENTS_KEY: 'federalDisbursements',
FISCAL_YEAR_KEY: 'FiscalYear',
CALENDAR_YEAR_KEY: 'CalendarYear',


// Disbursements data keys for redux store
DISBURSEMENTS_ALL_KEY: 'disbursementsAll',
Expand Down
10 changes: 5 additions & 5 deletions gatsby-site/src/state/reducers/production-volumes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import CONSTANTS from '../../js/constants';
import utils from '../../js/utils';

const initialState = {
FiscalYear: {
[CONSTANTS.FISCAL_YEAR_KEY]: {
[CONSTANTS.PRODUCTION_VOLUMES_OIL_KEY]: undefined,
[CONSTANTS.PRODUCTION_VOLUMES_GAS_KEY]: undefined,
[CONSTANTS.PRODUCTION_VOLUMES_COAL_KEY]: undefined
},
CalendarYear: {
[CONSTANTS.CALENDAR_YEAR_KEY]: {
[CONSTANTS.PRODUCTION_VOLUMES_OIL_KEY]: undefined,
[CONSTANTS.PRODUCTION_VOLUMES_GAS_KEY]: undefined,
[CONSTANTS.PRODUCTION_VOLUMES_COAL_KEY]: undefined
Expand Down Expand Up @@ -69,14 +69,14 @@ export default (state = initialState, action) => {
**/

const getFiscalCalendarYear = (key, source,fiscalYear,calendarYear) => {
if(source === undefined) return {FiscalYear: undefined, CalendarYear: undefined};
if(source === undefined) return {[CONSTANTS.FISCAL_YEAR_KEY]: undefined, [CONSTANTS.CALENDAR_YEAR_KEY]: undefined};

let fiscalYearItem = source.find(item => (item.data.ProductionMonth === "September"));
let calendarYearItem = source.find(item => (item.data.ProductionMonth === "December"));
fiscalYear[key] = (fiscalYearItem && parseInt(fiscalYearItem.data.ProductionYear));
calendarYear[key] = (calendarYearItem && parseInt(calendarYearItem.data.ProductionYear));
return {FiscalYear: fiscalYear,
CalendarYear: calendarYear};
return {[CONSTANTS.FISCAL_YEAR_KEY]: fiscalYear,
[CONSTANTS.CALENDAR_YEAR_KEY]: calendarYear};
}

/**
Expand Down

0 comments on commit 4163493

Please sign in to comment.