Fix SQL query parameter order in inventory update: Swap parameters in the execute call to correctly update inventory quantity based on the new quantity and inventory ID. Add comment for clarity on SQL operation.

This commit is contained in:
Torsten Schulz (local)
2026-01-29 16:10:34 +01:00
parent 9f1c54fde9
commit c24aa63f97
2 changed files with 4 additions and 2 deletions

View File

@@ -1312,7 +1312,8 @@ impl DirectorWorker {
new_quantity: i32,
) -> Result<(), DbError> {
conn.prepare("update_inventory_qty", QUERY_UPDATE_INVENTORY_QTY)?;
conn.execute("update_inventory_qty", &[&inventory_id, &new_quantity])?;
// SQL: UPDATE inventory SET quantity = $1 WHERE id = $2
conn.execute("update_inventory_qty", &[&new_quantity, &inventory_id])?;
Ok(())
}