web needs fixes

This commit is contained in:
Filipriec
2026-08-26 15:32:39 +02:00
parent 313166eae5
commit ec1596f0ea
5 changed files with 42 additions and 18 deletions

View File

@@ -140,7 +140,7 @@ impl BuilderForm {
// takes no column that posts to one profile's books, and no link
// may point at the table being created.
global: self.global,
table_name: self.table_name.trim().to_string(),
table_name: self.table_name.clone(),
};
// Drop display columns whose column is gone, so a stale post cannot
@@ -181,7 +181,7 @@ impl BuilderForm {
.zip(self.generated_alias_names.iter())
.map(|(source, alias)| GeneratedAlias {
source: source.trim().to_string(),
alias: alias.trim().to_string(),
alias: alias.clone(),
})
.collect(),
}
@@ -576,16 +576,16 @@ mod tests {
form.column_rounding.push("exact".into());
form.column_currencies.push("EUR".into());
form.generated_alias_sources = vec!["debit".into(), "account".into()];
form.generated_alias_names = vec![" md ".into(), "ucet".into()];
form.generated_alias_names = vec!["Md 🙂".into(), "ucet".into()];
let mut draft = form.to_draft();
draft.columns.catalog = crate::schema::tests::catalog();
assert_eq!(draft.alias_for("debit"), "md");
assert_eq!(draft.alias_for("debit"), "Md 🙂");
assert_eq!(
draft.aliased_generated_columns(),
vec![
("debit".to_string(), "md".to_string()),
("debit".to_string(), "Md 🙂".to_string()),
("account".to_string(), "ucet".to_string()),
]
);
@@ -601,8 +601,8 @@ mod tests {
};
let rows = page.column_rows();
let row = |name: &str| rows.iter().find(|row| row.name == name).unwrap();
assert_eq!(row("debit").alias_source.as_deref(), Some("debit"));
assert_eq!(row("debit").alias, "md");
assert_eq!(row("Md 🙂").alias_source.as_deref(), Some("debit"));
assert_eq!(row("Md 🙂").alias, "Md 🙂");
// `account` is reported by the catalog, so it is named there and the
// physical column it lands in is not offered a second field.
assert_eq!(row("account").alias_source.as_deref(), Some("account"));