Repository navigation
plugins: count every active mission in the community stats - #21678
Merged
freesteph merged 2 commits intoSep 15, 2026
Merged
Conversation
freesteph
requested changes
Sep 14, 2026
freesteph
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Some feedback around code organisation but all good otherwise
The community filter was fixed in betagouv#20910 to stop looking only at the last mission, since member files are not sorted chronologically. The render_community_stats tag still used missions.last to compute the total and per-domaine counts, so members whose active mission is not the last entry were left out of the "N membres" figure on /jobs and the stats on /communaute. Reuse Beta::Member#active_missions like the filter does.
Following review: the RenderCommunityStatsTag example now lives in spec/plugins/community_spec.rb with the filter one, both nested under a single top-level describe to satisfy RSpec/MultipleDescribes, and the "active mission is not the last one" case is tested on Beta::Member#active_missions in spec/lib/models/member_spec.rb.
freesteph
force-pushed
the
fix/community-stats-active-missions
branch
from
September 15, 2026 08:14
3444bc3 to
ee57403
Compare
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 free
to 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.
While reading #20910, which stopped the
communityfilter from looking only atmissions.last(member files aren't sorted chronologically), I noticed therender_community_statstag in the same file still does exactly that:That condition drives
totaland the per-domaine counts, so the "N membres" figure on /jobs and the stats on /communaute leave out anyone whose active mission isn't the last entry in their file. I ran both conditions overcontent/_authorsat 2876a65 today: the old one gives 1290 members,Beta::Member#active_missionsgives 1362. All 72 missing people have an active mission that isn't the last one (none of them are there because of a missing end date).The fix reuses
Beta::Member.new(author.data).active_missions.any?, like the filter does, and drops thenowvariable that's no longer used.employeranddomaineOverDatedon't change.I added
spec/plugins/community_stats_spec.rb. Without the fix, the case where the active mission comes first fails (expected: 2, got: 1); with it, both examples pass. The wholerspecsuite passes (62 examples), and rubocop 1.90.0 from the lockfile reports nothing on the two files. I ran this in aruby:3.4-bookwormcontainer with the gems installed by hand, since I don't have Ruby 4.0.6 locally.AI tools used