Fix gas cost chart when there is a single meter #4150
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Testing #4123 I noticed a long standing issue with the gas costs chart.
The issue only affects schools with a single gas meter and only on the 2 year comparison chart.
The cost pages use charts named with an
electricity_
prefix. The default definition of that is to show the electricity costs. However the charts override that by specifying a meter (either a real gas/electricity meter or the aggregate one), which means the charts then shows the costs for that meter.When a school has a single meter, the 2 year comparison chart was not specifying a meter, so it was defaulting to the electricity costs.
I've fixed this by updating the partials to build a chart_config for the aggregate (gas or electricity) meter so the right values are used.
The naming is a hold-over from previous versions of these pages and ideally needs tidying up. We should do that as a separate exercise, but there's a lot of other chart configurations to tidy as well.