Fixing automatic product_number assignment

This commit is contained in:
Ian Roddis committed 2026-08-04 16:55:05 -03:00
1 parent d54df47a2c
commit 9ebd0f4498
1 file changed
+3 -1
+3 -1
View File
@@ -250,7 +250,9 @@ async def import_scopes(db: AsyncSession, rows: list[dict]) -> ScopeImportResult
for offset, row in enumerate(rows):
# +2: 1-based, and the header occupies row 1.
row_num = offset + 2
product_number = _text(row.get("product_number")) or _text(row.get("model"))
model_suffix = _text(row.get("model_suffix"))
default_product_number = f"{_text(row.get('model'))} {row.get('magnification_min')}-{row.get('magnification_max')}x{row.get('objective_lens')} {row.get('model_suffix')}".strip()
product_number = _text(row.get("product_number")) or default_product_number
result = ScopeImportRowResult(
row=row_num, product_number=product_number, status="skipped", messages=[]
)