Changed initial_weight to be net weight, not gross weight

This commit is contained in:
Matt Gerega
2024-04-10 11:00:46 -04:00
parent dad446621f
commit c6f9abeced
14 changed files with 159 additions and 203 deletions

View File

@@ -86,7 +86,7 @@ def test_update_spool_weights(random_filament: dict[str, Any]):
"filament_id": random_filament["id"],
"remaining_weight": 1000,
"initial_weight": 1255,
"empty_weight": 246,
"spool_weight": 246,
"location": "The Pantry",
"lot_nr": "123456789",
},
@@ -98,8 +98,8 @@ def test_update_spool_weights(random_filament: dict[str, Any]):
first_used = "2023-01-01T12:00:00+02:00"
last_used = "2023-01-02T12:00:00+02:00"
remaining_weight = 750
initial_weight = 1250
empty_weight = 245
initial_weight = 1005
spool_weight = 245
location = "Living Room"
lot_nr = "987654321"
comment = "abcdefghåäö"
@@ -117,13 +117,13 @@ def test_update_spool_weights(random_filament: dict[str, Any]):
"archived": archived,
"price": price,
"initial_weight": initial_weight,
"empty_weight": empty_weight,
"spool_weight": spool_weight,
},
)
result.raise_for_status()
# Verify
used_weight = initial_weight - empty_weight - remaining_weight
used_weight = initial_weight - remaining_weight
used_length = length_from_weight(
weight=used_weight,
density=random_filament["density"],
@@ -139,7 +139,7 @@ def test_update_spool_weights(random_filament: dict[str, Any]):
assert spool["first_used"] == "2023-01-01T10:00:00Z"
assert spool["last_used"] == "2023-01-02T10:00:00Z"
assert spool["initial_weight"] == pytest.approx(initial_weight)
assert spool["empty_weight"] == pytest.approx(empty_weight)
assert spool["spool_weight"] == pytest.approx(spool_weight)
assert spool["remaining_weight"] == pytest.approx(remaining_weight)
assert spool["used_weight"] == pytest.approx(used_weight)
assert spool["remaining_length"] == pytest.approx(remaining_length)