Skip to content

Commit

Permalink
Fixes to End of Game report
Browse files Browse the repository at this point in the history
  • Loading branch information
rhernandez-intertech committed Mar 18, 2024
1 parent d8e5958 commit 2ce1130
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 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
2 changes: 1 addition & 1 deletion src/components/EnergyUseLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function EnergyUseLineChart(props: EnergyUseLineChartProps) {
const layout = {
width: props.parentElement.width,
title: {
text: `Budget Period ${xYears.length} GHG Reduction`,
text: `GHG Reductions through Budget Period ${xYears.length}`,
font: {
family: 'Roboto',
size: 24
Expand Down

0 comments on commit 2ce1130

Please sign in to comment.