diff --git a/app.py b/app.py index 8d70fcb..90fcde6 100644 --- a/app.py +++ b/app.py @@ -36,7 +36,7 @@ app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=1) # 1. Define the version -APP_VERSION = '0.11.0' +APP_VERSION = '0.11.1' # 2. Inject it into all templates automatically @app.context_processor diff --git a/blueprints/__pycache__/counting.cpython-313.pyc b/blueprints/__pycache__/counting.cpython-313.pyc index 07feb82..4f56345 100644 Binary files a/blueprints/__pycache__/counting.cpython-313.pyc and b/blueprints/__pycache__/counting.cpython-313.pyc differ diff --git a/blueprints/__pycache__/data_imports.cpython-313.pyc b/blueprints/__pycache__/data_imports.cpython-313.pyc index 6575814..c549d2e 100644 Binary files a/blueprints/__pycache__/data_imports.cpython-313.pyc and b/blueprints/__pycache__/data_imports.cpython-313.pyc differ diff --git a/blueprints/counting.py b/blueprints/counting.py index 94bb7be..6f4f078 100644 --- a/blueprints/counting.py +++ b/blueprints/counting.py @@ -310,8 +310,14 @@ def scan_lot(session_id, location_count_id): # Check against MASTER baseline master = query_db(''' - SELECT * FROM BaselineInventory_Master + SELECT + system_bin, + SUM(system_quantity) as system_quantity, + MAX(item) as item, + MAX(description) as description + FROM BaselineInventory_Master WHERE session_id = ? AND lot_number = ? AND system_bin = ? + GROUP BY system_bin ''', [session_id, lot_number, location['location_name']], one=True) # Determine master_status (only if not a duplicate issue) @@ -328,8 +334,16 @@ def scan_lot(session_id, location_count_id): else: # Check if lot exists in different location master_other = query_db(''' - SELECT * FROM BaselineInventory_Master + SELECT + system_bin, + SUM(system_quantity) as system_quantity, + MAX(item) as item, + MAX(description) as description + FROM BaselineInventory_Master WHERE session_id = ? AND lot_number = ? + GROUP BY system_bin + ORDER BY system_bin + LIMIT 1 ''', [session_id, lot_number], one=True) if master_other: @@ -346,8 +360,16 @@ def scan_lot(session_id, location_count_id): # For duplicates, still check baseline for item info if not master: master = query_db(''' - SELECT * FROM BaselineInventory_Master + SELECT + system_bin, + SUM(system_quantity) as system_quantity, + MAX(item) as item, + MAX(description) as description + FROM BaselineInventory_Master WHERE session_id = ? AND lot_number = ? + GROUP BY system_bin + ORDER BY system_bin + LIMIT 1 ''', [session_id, lot_number], one=True) master_status = 'match' # Don't override with wrong_location for duplicates variance_lbs = None diff --git a/blueprints/data_imports.py b/blueprints/data_imports.py index 8ebd24b..2a109df 100644 --- a/blueprints/data_imports.py +++ b/blueprints/data_imports.py @@ -94,6 +94,7 @@ def upload_master(session_id): conn = get_db() cursor = conn.cursor() + cursor.execute('DELETE FROM BaselineInventory_Master WHERE session_id = ?', [session_id]) try: stream = io.StringIO(file.stream.read().decode("UTF8"), newline=None) csv_reader = csv.DictReader(stream) diff --git a/templates/count_location.html b/templates/count_location.html index 1d7acc3..606f81c 100644 --- a/templates/count_location.html +++ b/templates/count_location.html @@ -102,7 +102,7 @@ onclick="openScanDetail('{{ scan.entry_id }}')">