Skip to content

Commit

Permalink
fix query : left quantity in inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelilahOu committed Oct 14, 2023
1 parent 6cc11f2 commit 675f8f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "client",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"author": "abdelilah ouaadouch",
"description": "inventory management app",
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/reposotories/product_repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn get_products(page: i32, connection: &mut SqliteConnection) -> Value {
products::price,
products::tva,
diesel::dsl::sql::<diesel::sql_types::BigInt>(
"COALESCE(SUM(inventory_mouvements.quantity), 0) AS quantity",
"COALESCE(SUM(CASE WHEN inventory_mouvements.model = 'IN' THEN inventory_mouvements.quantity WHEN inventory_mouvements.model = 'OUT' THEN -inventory_mouvements.quantity END), 0) AS quantity",
),
))
.group_by(products::id)
Expand Down
Binary file modified src-tauri/stocker.sqlite
Binary file not shown.

0 comments on commit 675f8f0

Please sign in to comment.