Fixed find spools not working if no vendor
This commit is contained in:
@@ -69,7 +69,11 @@ async def find(
|
||||
article_number: Optional[str] = None,
|
||||
) -> list[models.Filament]:
|
||||
"""Find a list of filament objects by search criteria."""
|
||||
stmt = select(models.Filament).options(contains_eager(models.Filament.vendor)).join(models.Filament.vendor)
|
||||
stmt = (
|
||||
select(models.Filament)
|
||||
.options(contains_eager(models.Filament.vendor))
|
||||
.join(models.Filament.vendor, isouter=True)
|
||||
)
|
||||
if vendor_name is not None:
|
||||
stmt = stmt.where(models.Vendor.name.ilike(f"%{vendor_name}%"))
|
||||
if vendor_id is not None:
|
||||
|
||||
@@ -74,8 +74,8 @@ async def find(
|
||||
"""Find a list of spool objects by search criteria."""
|
||||
stmt = (
|
||||
sqlalchemy.select(models.Spool)
|
||||
.join(models.Spool.filament)
|
||||
.join(models.Filament.vendor)
|
||||
.join(models.Spool.filament, isouter=True)
|
||||
.join(models.Filament.vendor, isouter=True)
|
||||
.options(contains_eager(models.Spool.filament).contains_eager(models.Filament.vendor))
|
||||
)
|
||||
if filament_name is not None:
|
||||
|
||||
Reference in New Issue
Block a user