Skip to content

Conversation

@zarino
Copy link
Member

@zarino zarino commented Dec 4, 2025

This mostly works, but I wasn’t sure what to do about the "Points distribution" statistics, since they’re compared across years, and the filter data is year-specific. I’ve had a stab at a potential solution, but TBH I barely understand what the code is doing at that point, so I’m not confident about it. @struan do you have any thoughts?

Screenshot 2025-12-04 at 17 45 29

Fixes #769.

@zarino zarino requested a review from struan December 4, 2025 17:47
@struan
Copy link
Member

struan commented Dec 16, 2025

my concern with the comparing the filtered list from this year with last is that if you then look at the same filter for the previous year you are going to get different numbers so I guess we possibly want to include something to say that it is only comparing for the councils matched this year, rather than all councils that match in the previous year?

@zarino
Copy link
Member Author

zarino commented Dec 16, 2025

@struan yep, I could add some wording to that effect 👍

Copy link
Member

@struan struan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a tidyup to the last commit but otherwise this looks good, modulo the text discussed elsewhere.

@zarino zarino force-pushed the 769-question-page-filters branch 3 times, most recently from a095825 to 1e9431d Compare December 17, 2025 17:57
Switching to the Homepage-style filter buttons will make it easier for
us to incorporate Homepage-style filtering by nation/country/etc to the
Question pages (#769).

Now that the “homepage” filter is being reused on three page types
(home, nation, question) this was a good opportunity to generalise
some of the code, including:

- rename `#home-page-main-filter` to `#main-filter`
- rename `ajaxLoadCouncilTypeScorecard` to `ajaxLoadPageFragments`
- separate `.loading-shimmer` from `ajaxLoadPageFragments` so that
  specific child elements can _appear_ to be reloaded, while the
  JavaScript simply reloads their common parent.

I also took the opportunity to tidy up the typography and vertical
rhythm of the Question page sections/headings.
Since the table of councils/scores on the Question page can now be
filtered by attributes like nation/region/imd/etc, it makes intuitive
sense that the statistics _above_ the table should _also_ respect those
filters.

The rising/falling cards already work with the filters, which is nice.
But the breakdown of total councils with each number of points does not.

A challenge here is that the points breakdowns include a comparison
with the previous year’s data. But filters are year-specific. What does
it mean to compare “Labour-controlled English Single Tiers” from 2025
and 2023?

I had a bit of a debate with Claude, and it suggested that we make this
change – comparing the stats of _the same specific councils_ across the
years, rather than trying to apply the same _filters_ across the years.
This way, you’ll see how many of the matching councils got each number
of points in 2025, and how many points they all got in 2023 too.

Seems fairly intuitive to me? But I’d appreciate a second opinion!

I am also a little bit “yuck” over how it’s re-implementing something
new, instead of re-using `get_scores_breakdown`, but maybe that’s just
un-avoidable.
@zarino zarino force-pushed the 769-question-page-filters branch from 1e9431d to f9b4c58 Compare December 17, 2025 18:02
@zarino zarino merged commit f9b4c58 into master Dec 17, 2025
4 of 5 checks passed
Sign up for free to 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.

[Scorecards] Add filters to question page

3 participants