Uh oh!
There was an error while loading. Please reload this page.
Make the CO2 intensity figure settable per fund page - #86
Open
taavipertman-glitch wants to merge 2 commits into
Open
Make the CO2 intensity figure settable per fund page#86taavipertman-glitch wants to merge 2 commits into
taavipertman-glitch wants to merge 2 commits into
Conversation
TUK75, TUK00 and TUV100 carried the figure as a literal in the markup, so every quarterly update meant a commit and a deploy. Add fund_co2_intensity to the pension pages under the same name TKF100 already uses, with the current figure as the fallback, so one field name serves all four funds. The field is text rather than number because trailing zeros are significant: TUK00's 133.80 renders as 133.8 once it becomes a float, which is why that one literal was already quoted and the other two were not. Enable show_in_rest on group_fund_savings_details too, so TKF100's existing field can be written the same way. TKF100 has no CO2 figure and the savings template hides the block while the field is empty, so that stays inert until a value exists. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fallback literal has to stay -- it is what the page shows until someone fills the field in -- but it also creates a second place the number can live, and the field silently wins. The quarterly WACI update has been "edit these three files" until now, so the next person to follow that habit on a fund whose field is already set would change nothing and have no way to notice. Comment only, no behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Moves the CO2 intensity figure for TUK75, TUK00 and TUV100 out of the markup and behind the
fund_co2_intensityACF field — the same field name TKF100 already uses — so the quarterly update stops needing a commit and a deploy.Stacked on #69 (
acf-investment-report-fields). Merge #69 first; I'll rebase onto master if you'd rather have it standalone.Changes
helpers/acf/fund-pension.php— newSustainabilityfield group withfund_co2_intensity, for the three pension page templatesfund-stocks-details.php,fund-bonds-details.php,fund-third-details.php—get_field('fund_co2_intensity') ?: '<current figure>', output escapedhelpers/acf/fund-savings.php—show_in_restongroup_fund_savings_detailsText field, not number
The three literals were inconsistent:
83.68and83.73as floats,'133.80'quoted. That quoting is load-bearing — as a float it renders133.8, dropping a significant digit. The field istextfor the same reason, matching TKF100's existing field. I checked thatsprintf('%s', …)output is identical for all three before and after, so nothing on the page changes until someone sets a field.TKF100
fund_co2_intensityalready exists for TKF100 but sits ingroup_fund_savings_details, which had noshow_in_rest— so a REST write there would have hit the same silent no-op #69 fixes for the documents group. The flag is added here.There is no CO2 figure for TKF100, and this does not invent one or start warning about it: the savings template already wraps the whole sustainability block in
if ($fund_co2_intensity), so it stays hidden until a value exists.Deploy notes
No visible change on merge — all four pages render exactly what they render today until a field is set. Automation is a separate step; note that the CO2 inputs are quarterly and partly manual (BlackRock/Xtrackers into
apps/esg/co2-intensity.sql), so this removes the deploy from the loop, not the manual data gathering.Same caveat as #69: ACF applies the group by
page_template, so a REST write depends on the live pages being on the matching templates.🤖 Generated with Claude Code