fix table
This commit is contained in:
@@ -20,6 +20,8 @@ from app.models import (
|
||||
VedomostRow,
|
||||
)
|
||||
from app.services.project_settings import (
|
||||
clear_cell_overflows,
|
||||
get_cell_overflows,
|
||||
get_column_mappings_list,
|
||||
get_project_params_map,
|
||||
get_simple_list_settings,
|
||||
@@ -123,7 +125,14 @@ def get_rows(db: Session, project_id: int, table_type: str) -> list[dict[str, An
|
||||
rows = db.scalars(
|
||||
select(model).where(model.project_id == project_id).order_by(model.row_index)
|
||||
).all()
|
||||
return [row_to_dict(r) for r in rows]
|
||||
overflow_map = get_cell_overflows(db, project_id, table_type)
|
||||
result = []
|
||||
for r in rows:
|
||||
data = row_to_dict(r)
|
||||
key = str(data.get("id") or data.get("row_index"))
|
||||
data["overflow_fields"] = overflow_map.get(key, [])
|
||||
result.append(data)
|
||||
return result
|
||||
|
||||
|
||||
def replace_rows(db: Session, project_id: int, table_type: str, rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
@@ -172,6 +181,7 @@ def generate_table(
|
||||
if table_type not in TABLE_TYPES:
|
||||
raise ValueError(f"Unknown table type: {table_type}")
|
||||
|
||||
clear_cell_overflows(db, project.id, table_type)
|
||||
mappings = _mappings_dict(db, project.id)
|
||||
components = load_components_for_variant(db, project)
|
||||
col_mappings = get_column_mappings_list(db, project.id, table_type)
|
||||
|
||||
Reference in New Issue
Block a user