use formatted_names in roles
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
Philipp Hofer 2025-05-17 09:13:06 +02:00
parent 7e10253e2e
commit c246e06e69
2 changed files with 7 additions and 3 deletions

View File

@ -40,9 +40,13 @@ impl Ord for Role {
impl Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if let Some(formatted_name) = &self.formatted_name {
write!(f, "{}", formatted_name)
} else {
write!(f, "{}", self.name)
}
}
}
impl Role {
pub async fn all(db: &SqlitePool) -> Vec<Role> {

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");
}