Making objective_lens a thing

This commit is contained in:
Ian Roddis committed 2026-08-04 16:48:00 -03:00
1 parent fcb4dbaa62
commit 12e6984c63
17 files changed
+115 -119

No files matched your search

+1 -3
View File
@@ -23,9 +23,7 @@ async def get_default(db: AsyncSession) -> Role | None:
async def set_default(db: AsyncSession, role: Role) -> Role:
"""Make ``role`` the sole default, clearing the flag on every other role."""
await db.execute(
sa_update(Role).where(Role.id != role.id).values(is_default=False)
)
await db.execute(sa_update(Role).where(Role.id != role.id).values(is_default=False))
role.is_default = True
await db.commit()
await db.refresh(role)
+3 -3
View File
@@ -24,9 +24,7 @@ async def list_by_augmented_parts(
if not augmented_part_ids:
return []
result = await db.execute(
select(ScopeInfo).where(
ScopeInfo.augmented_part_id.in_(augmented_part_ids)
)
select(ScopeInfo).where(ScopeInfo.augmented_part_id.in_(augmented_part_ids))
)
return list(result.scalars().all())
@@ -38,6 +36,7 @@ async def create(
magnification_min: float | None = None,
magnification_max: float | None = None,
model_suffix: str | None = None,
objective_lens_diameter_mm: float | None = None,
objective_thread_pitch: str | None = None,
) -> ScopeInfo:
info = ScopeInfo(
@@ -45,6 +44,7 @@ async def create(
magnification_min=magnification_min,
magnification_max=magnification_max,
model_suffix=model_suffix,
objective_lens_diameter_mm=objective_lens_diameter_mm,
objective_thread_pitch=objective_thread_pitch,
)
db.add(info)