Skip to content

Commit

Permalink
schema: allow alumni to have roles
Browse files Browse the repository at this point in the history
This enables the compiler team to recognise their alumni for the role
that they held while active.
  • Loading branch information
davidtwco authored and Mark-Simulacrum committed Dec 12, 2024
1 parent 01a5789 commit 087fde7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,14 @@ impl Team {
let alumni = data
.teams()
.chain(data.archived_teams())
.flat_map(|t| t.alumni())
.map(|a| a.as_str())
.flat_map(|t| t.explicit_alumni())
.map(|a| a.github.as_str())
.filter(|person| !active_members.contains(person));
members.extend(alumni);
}
Ok(members)
}

pub(crate) fn alumni(&self) -> &[String] {
self.people.alumni.as_ref().map_or(&[], Vec::as_slice)
}

pub(crate) fn raw_lists(&self) -> &[TeamList] {
&self.lists
}
Expand Down Expand Up @@ -478,6 +474,10 @@ impl Team {
&self.people.members
}

pub(crate) fn explicit_alumni(&self) -> &[TeamMember] {
self.people.alumni.as_ref().map_or(&[], Vec::as_slice)
}

pub(crate) fn contains_person(&self, data: &Data, person: &Person) -> Result<bool, Error> {
let members = self.members(data)?;
Ok(members.contains(person.github()))
Expand Down Expand Up @@ -525,7 +525,7 @@ impl std::cmp::Ord for GitHubTeam<'_> {
pub(crate) struct TeamPeople {
pub leads: Vec<String>,
pub members: Vec<TeamMember>,
pub alumni: Option<Vec<String>>,
pub alumni: Option<Vec<TeamMember>>,
#[serde(default)]
pub included_teams: Vec<String>,
#[serde(default = "default_false")]
Expand Down
14 changes: 10 additions & 4 deletions src/static_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ impl<'a> Generator<'a> {
for member in team.explicit_members().iter().cloned() {
website_roles.insert(member.github, member.roles);
}
for alum in team.explicit_alumni().iter().cloned() {
website_roles.insert(alum.github, alum.roles);
}

let leads = team.leads();
let mut members = Vec::new();
Expand All @@ -165,14 +168,17 @@ impl<'a> Generator<'a> {
members.sort_by_key(|member| !member.is_lead);

let mut alumni = Vec::new();
for github_name in team.alumni() {
if let Some(person) = self.data.person(github_name) {
for alum in team.explicit_alumni() {
if let Some(person) = self.data.person(&alum.github) {
alumni.push(v1::TeamMember {
name: person.name().into(),
github: github_name.to_string(),
github: alum.github.to_string(),
github_id: person.github_id(),
is_lead: false,
roles: Vec::new(),
roles: website_roles
.get(alum.github.as_str())
.cloned()
.unwrap_or_default(),
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ fn validate_inactive_members(data: &Data, errors: &mut Vec<String>) {
for member in members {
referenced_members.insert(member);
}
for person in team.alumni() {
referenced_members.insert(person);
for person in team.explicit_alumni() {
referenced_members.insert(person.github.as_str());
}
for list in team.raw_lists() {
for person in &list.extra_people {
Expand Down

0 comments on commit 087fde7

Please sign in to comment.