Skip to content

Commit 8746583

Browse files
committed
Shuffle fundable people on the server
1 parent 84e1821 commit 8746583

File tree

4 files changed

+104
-3
lines changed

4 files changed

+104
-3
lines changed

Cargo.lock

Lines changed: 93 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ serde_json = "1.0"
1616
rust_team_data = { git = "https://github.com/rust-lang/team" }
1717
percent-encoding = "2.3.2"
1818
rayon = "1"
19+
rand = "0.9"
1920

2021
[dev-dependencies]
2122
time = { version = "0.3.44", features = ["parsing"] }

src/render.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{BaseUrl, ENGLISH, LAYOUT};
77
use anyhow::Context;
88
use handlebars::Handlebars;
99
use handlebars_fluent::{Loader, SimpleLoader};
10+
use rand::seq::SliceRandom;
1011
use rayon::iter::IntoParallelRefIterator;
1112
use rayon::iter::ParallelIterator;
1213
use serde::Serialize;
@@ -269,7 +270,14 @@ pub fn render_funding(
269270
render_ctx: &RenderCtx,
270271
all_team_members: &AllTeamMembers,
271272
) -> anyhow::Result<()> {
272-
let data = render_ctx.teams.funding_data(all_team_members);
273+
let mut data = render_ctx.teams.funding_data(all_team_members);
274+
275+
// To reduce unnecessary ordering bias, we shuffle the list of fundable people.
276+
// While we also shuffle on the client (frontend), this does not work for people
277+
// with JavaScript enabled. And since the website is rebuilt regularly every day,
278+
// this ensures that even the baseline version of the page without client-side
279+
// shuffling will not always be the same.
280+
data.people.shuffle(&mut rand::rng());
273281

274282
// Index page
275283
for_all_langs("funding/index.html", |dst_path, lang| {

src/teams.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ pub struct FundablePerson {
505505

506506
#[derive(Serialize)]
507507
pub struct FundingData {
508-
people: Vec<FundablePerson>,
508+
pub people: Vec<FundablePerson>,
509509
}
510510

511511
pub fn load_rust_teams() -> anyhow::Result<RustTeamData> {

0 commit comments

Comments
 (0)