Skip to content

Commit

Permalink
Merge pull request #280 from ORNL-AMO/issue-123-c
Browse files Browse the repository at this point in the history
Issues 123 & 180
  • Loading branch information
nbintertech authored Mar 19, 2024
2 parents d2c0d46 + 2ce1130 commit fc5c0af
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions src/components/EndGameReport/EndGameReportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,28 @@ function EndGameReport(props: ReportProps) {
const carbonSavingsPercentFormatted: string = (endOfGameResults.carbonSavingsPercent * 100).toFixed(2);
const gameTotalNetCostFormatted: string = noDecimalsFormatter.format(endOfGameResults.gameTotalSpending);
const projectedFinancedSpendingFormatted: string = noDecimalsFormatter.format(endOfGameResults.projectedFinancedSpending);
const gameCurrentAndProjectedSpendingFormatted: string = noDecimalsFormatter.format(endOfGameResults.gameCurrentAndProjectedSpending);
const costPerCarbonSavingsFormatted: string = endOfGameResults.costPerCarbonSavings !== undefined ? Intl.NumberFormat('en-US', {
minimumFractionDigits: 0,
maximumFractionDigits: 2,
}).format(endOfGameResults.costPerCarbonSavings) : '0';


console.log('props.mutableStats.currentGameYear '+ props.mutableStats.currentGameYear);
console.log('props.mutableStats.gameYearInterval '+ props.mutableStats.gameYearInterval);
console.log('props.mutableStats.gameYearDisplayOffset '+ props.mutableStats.gameYearDisplayOffset);

return (
<Fragment>
{props.mutableStats.gameYearInterval == 1 &&
<Typography variant='h3'>
Looking Forward - Year {props.mutableStats.currentGameYear}
</Typography>
}
{props.mutableStats.gameYearInterval == 2 &&
<Typography variant='h3'>
Looking Forward - Years {props.mutableStats.gameYearDisplayOffset} & {props.mutableStats.gameYearDisplayOffset + 1}
</Typography>
}
<ParentSize>
{(parent) => (
<EnergyUseLineChart
Expand Down Expand Up @@ -129,7 +144,7 @@ function EndGameReport(props: ReportProps) {
<ListItemText
primary={
<Typography variant={'h5'}>
You have spent{' '}<Emphasis>${gameTotalNetCostFormatted}</Emphasis>{' '} throughout the game.
You have spent{' '}<Emphasis>${gameTotalNetCostFormatted}</Emphasis>{' '} on GHG reduction measures.
</Typography>
}
/>
Expand All @@ -154,7 +169,7 @@ function EndGameReport(props: ReportProps) {
<ListItemText
primary={
<Typography variant={'h5'}>
You are projected to spend {' '}<Emphasis>${projectedFinancedSpendingFormatted}</Emphasis>{' '} on financed and renewed projects in future years
After this budget period, you still have {' '}<Emphasis>${gameCurrentAndProjectedSpendingFormatted}</Emphasis>{' '} on financed and renewable projects in the coming years.
</Typography>
}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/EnergyUseLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function EnergyUseLineChart(props: EnergyUseLineChartProps) {
const data = [];
let xYears: number[] = Array.from([...props.yearRangeInitialStats], statYear => statYear.currentGameYear);
let xTicks: string[] = Array.from(xYears, year => {
return 'Year ' + String(year);
return 'Budget Period ' + String(year);
});

let energyTypeYearValues = {
Expand Down Expand Up @@ -65,7 +65,7 @@ export default function EnergyUseLineChart(props: EnergyUseLineChartProps) {
const layout = {
width: props.parentElement.width,
title: {
text: `${xYears.length} Year GHG Reduction`,
text: `GHG Reductions through Budget Period ${xYears.length}`,
font: {
family: 'Roboto',
size: 24
Expand Down

0 comments on commit fc5c0af

Please sign in to comment.