mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-23 18:42:19 -05:00
Spool.from_db reports remaining_weight as max(initial - used, 0), but find_groups' remaining_expr omitted the clamp. A spool used past empty therefore contributed a negative number to total_remaining_weight, so a group's total no longer matched the sum of the spools it contains — two 500 g spools, one with 200 g used and one with 800 g, reported 0 g instead of 300 g. Mirror the clamp with CASE rather than func.greatest, which is not portable across all four supported databases. Covered by a new integration test.