fixing errors2
This commit is contained in:
@@ -545,6 +545,11 @@ impl TableDraft {
|
||||
)
|
||||
});
|
||||
}
|
||||
// A ragged post can leave no columns at all, and "add at least one
|
||||
// column" would then be answering a question nobody asked.
|
||||
if let Some(ragged) = self.columns.ragged {
|
||||
return Err(ragged.message(locale));
|
||||
}
|
||||
if self.columns.is_empty() {
|
||||
return Err(tr!(locale, "draft-err-no-columns"));
|
||||
}
|
||||
|
||||
@@ -107,6 +107,15 @@ impl BuilderForm {
|
||||
pub(crate) fn to_draft(&self) -> TableDraft {
|
||||
let creating_new_profile = self.creating_new_profile();
|
||||
|
||||
let (added, ragged) = columns_from_rows(
|
||||
&self.column_names,
|
||||
&self.column_types,
|
||||
&self.column_indexed,
|
||||
&self.column_quantity_ledger,
|
||||
&self.column_required,
|
||||
&self.column_rounding,
|
||||
&self.column_currencies,
|
||||
);
|
||||
let columns = ColumnDraft {
|
||||
name_input: self.column_name_input.clone(),
|
||||
type_input: self.column_type_input.clone(),
|
||||
@@ -120,15 +129,8 @@ impl BuilderForm {
|
||||
required_input: self.column_required_input.clone(),
|
||||
rounding_input: self.column_rounding_input.clone(),
|
||||
currency_input: self.column_currency_input.clone(),
|
||||
added: columns_from_rows(
|
||||
&self.column_names,
|
||||
&self.column_types,
|
||||
&self.column_indexed,
|
||||
&self.column_quantity_ledger,
|
||||
&self.column_required,
|
||||
&self.column_rounding,
|
||||
&self.column_currencies,
|
||||
),
|
||||
added,
|
||||
ragged,
|
||||
// Filled in by the loader from `ListColumnTypes`, never by the
|
||||
// form: it is the vocabulary the draft is validated against.
|
||||
catalog: ColumnCatalog::default(),
|
||||
|
||||
Reference in New Issue
Block a user