Skip to content

Make the CO2 intensity figure settable per fund page - #86

Open
taavipertman-glitch wants to merge 2 commits into
acf-investment-report-fieldsfrom
acf-co2-intensity-fields
Open

Make the CO2 intensity figure settable per fund page#86
taavipertman-glitch wants to merge 2 commits into
acf-investment-report-fieldsfrom
acf-co2-intensity-fields

Conversation

@taavipertman-glitch

Copy link
Copy Markdown
Contributor

Summary

Moves the CO2 intensity figure for TUK75, TUK00 and TUV100 out of the markup and behind the fund_co2_intensity ACF 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 — new Sustainability field group with fund_co2_intensity, for the three pension page templates
  • fund-stocks-details.php, fund-bonds-details.php, fund-third-details.phpget_field('fund_co2_intensity') ?: '<current figure>', output escaped
  • helpers/acf/fund-savings.phpshow_in_rest on group_fund_savings_details

Text field, not number

The three literals were inconsistent: 83.68 and 83.73 as floats, '133.80' quoted. That quoting is load-bearing — as a float it renders 133.8, dropping a significant digit. The field is text for the same reason, matching TKF100's existing field. I checked that sprintf('%s', …) output is identical for all three before and after, so nothing on the page changes until someone sets a field.

TKF100

fund_co2_intensity already exists for TKF100 but sits in group_fund_savings_details, which had no show_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

taavipertman-glitchand others added 2 commits August 14, 2026 15:14
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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@taavipertman-glitch