Merge pull request 'use formatted_names in roles' (#1034) from format-roles into main
Some checks failed
CI/CD Pipeline / test (push) Successful in 15m0s
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled

Reviewed-on: #1034
This commit is contained in:
philipp 2025-05-17 09:13:49 +02:00
commit b3033fbc72
2 changed files with 7 additions and 3 deletions

View File

@ -40,7 +40,11 @@ impl Ord for Role {
impl Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.name)
if let Some(formatted_name) = &self.formatted_name {
write!(f, "{}", formatted_name)
} else {
write!(f, "{}", self.name)
}
}
}

View File

@ -377,14 +377,14 @@ impl User {
if let Some(old_financial) = self.financial(db).await {
self.remove_role(db, updated_by, &old_financial).await?;
old.push_str(&old_financial.name);
old.push_str(&old_financial.to_string());
} else {
old.push_str("Keine Ermäßigung");
}
if let Some(new_financial) = financial {
self.add_role(db, updated_by, &new_financial).await?;
new.push_str(&new_financial.name);
new.push_str(&new_financial.to_string());
} else {
new.push_str("Keine Ermäßigung");
}