use formatted_names in roles #1034

Merged
philipp merged 1 commits from format-roles into main 2025-05-17 09:13:53 +02:00
2 changed files with 7 additions and 3 deletions

View File

@ -40,7 +40,11 @@ impl Ord for Role {
impl Display for Role { impl Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 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 { if let Some(old_financial) = self.financial(db).await {
self.remove_role(db, updated_by, &old_financial).await?; self.remove_role(db, updated_by, &old_financial).await?;
old.push_str(&old_financial.name); old.push_str(&old_financial.to_string());
} else { } else {
old.push_str("Keine Ermäßigung"); old.push_str("Keine Ermäßigung");
} }
if let Some(new_financial) = financial { if let Some(new_financial) = financial {
self.add_role(db, updated_by, &new_financial).await?; self.add_role(db, updated_by, &new_financial).await?;
new.push_str(&new_financial.name); new.push_str(&new_financial.to_string());
} else { } else {
new.push_str("Keine Ermäßigung"); new.push_str("Keine Ermäßigung");
} }