This commit is contained in:
Dominic Grimm 2023-03-05 14:43:40 +01:00
parent c32356b2bc
commit 487974a07c
No known key found for this signature in database
GPG Key ID: 6F294212DEAAC530
1 changed files with 16 additions and 26 deletions

View File

@ -114,32 +114,22 @@ async fn teachers(
.teacher_reports()
.await?
.into_iter()
.filter_map(|t| {
if t.long_name.starts_with("Abi-Aufsicht")
|| t.long_name == "SBBZ"
|| t.long_name == "N.N."
|| t.long_name == "Werkrealschule"
{
None
} else {
Some(User {
username: {
let escaped = escape_username(&t.name);
match usernames.get_mut(&escaped) {
Some(x) => {
*x += 1;
format!("{}{}", escaped, x)
}
None => {
usernames.insert(escaped.to_owned(), 1);
escaped
}
}
},
first_name: t.fore_name,
last_name: escape_last_name(&t.long_name).to_string(),
})
}
.map(|t| User {
username: {
let escaped = escape_username(&t.name);
match usernames.get_mut(&escaped) {
Some(x) => {
*x += 1;
format!("{}{}", escaped, x)
}
None => {
usernames.insert(escaped.to_owned(), 1);
escaped
}
}
},
first_name: t.fore_name,
last_name: escape_last_name(&t.long_name).to_string(),
})
.collect())
}