Update production log SQL queries to include completion count: Modified the QUERY_INSERT_UPDATE_PRODUCTION_LOG to add a new completion_count field, ensuring accurate tracking of completed productions. Updated related documentation to reflect changes in production counting logic and SQL migrations.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m51s

This commit is contained in:
Torsten Schulz (local)
2026-04-17 16:59:22 +02:00
parent 48d8e9b293
commit 75a1e5b306
5 changed files with 33 additions and 9 deletions

View File

@@ -1462,11 +1462,13 @@ pub const QUERY_INSERT_UPDATE_PRODUCTION_LOG: &str = r#"
product_id,
quantity,
producer_id,
production_date
) VALUES ($1, $2, $3, $4, CURRENT_DATE)
production_date,
completion_count
) VALUES ($1, $2, $3, $4, CURRENT_DATE, 1)
ON CONFLICT (producer_id, product_id, region_id, production_date)
DO UPDATE
SET quantity = falukant_log.production.quantity + EXCLUDED.quantity;
SET quantity = falukant_log.production.quantity + EXCLUDED.quantity,
completion_count = falukant_log.production.completion_count + 1;
"#;
pub const QUERY_ADD_OVERPRODUCTION_NOTIFICATION: &str = r#"