Fixed formatting

This commit is contained in:
Matt Gerega
2024-03-26 14:02:17 -04:00
parent 1d6830d769
commit 83fd3073ec
3 changed files with 51 additions and 28 deletions

View File

@@ -194,12 +194,8 @@ async def update(
if k == "filament_id":
spool.filament = await filament.get_by_id(db, v)
# If there is no initial_weight, calculate it from the filament weight
if (
spool.initial_weight is None
and spool.empty_weight is None
and spool.filament.weight is not None
):
spool_weight = (spool.empty_weight if spool.empty_weight is not None else 0)
if spool.initial_weight is None and spool.empty_weight is None and spool.filament.weight is not None:
spool_weight = spool.empty_weight if spool.empty_weight is not None else 0
spool.initial_weight = spool.filament.weight + spool_weight
spool.empty_weight = spool_weight