From 136fe03e072115561c4c16039a001b3a912c86b6 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 25 Jan 2026 20:40:51 -0600 Subject: [PATCH] v0.11.1 - Fixed weight Discrepancy bug --- app.py | 2 +- .../__pycache__/counting.cpython-313.pyc | Bin 23716 -> 24204 bytes .../__pycache__/data_imports.cpython-313.pyc | Bin 7432 -> 7548 bytes blueprints/counting.py | 28 ++++++++++++++++-- blueprints/data_imports.py | 1 + templates/count_location.html | 27 +++++++++++++---- 6 files changed, 49 insertions(+), 9 deletions(-) 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 07feb82f9470cfb5d92aadacea97d15a9af82d74..4f563455b5d172e68b87010091e3852ba8531242 100644 GIT binary patch delta 595 zcmZ3old)$nBj0CUUM>b8n0B!&b64(0z6L$LL?cE91}+6C2zK>xbq-O0^FhMJmBl5g zx$#Mvc{*H^Q)E@5p#p`aiFqZNC6ziTs(l?JG%|teH5C$z6+jG3>6FysWA9^@Yypx_jV1uN zxCWs*8AFYar>|#-g5l;_`r#aMoZ=iGgc!I*7ig@ozo=w=fz#%I%12>NJ`ctQw+|AN z`7M&gxK#x{h%pGuUJ%q=QSwooTgJ4*=bO~z4hthOZh2HGG1Cs9uFV%Lni-kA*(Qft z88BtAY;Ly_WntX0d9Gaq6XS!;-y9@Z7~gN^cU9$Jbf0YMJD)LN^HtwpOiUt7n=b~; mVrQ)0oD&hiERoL4$o`p`fk^;Fq%nSA0SSBvVV`^@`T_uhsIsE~ delta 274 zcmeC#%eZ7GBj0CUUM>b8;5=KFIXi13UxS`-RXLXe6a>5axH^X@XiZ)qt3EkP-+uB@ zeI=%-z}5Hm{kRUN`z%E2x_h<0m{jkcKCebnp|LIB*rX{DkWyx;r4-J z^A4+KMy7by$+k8IOf}4#^KC>~7#D4Bb%xxPt&kQfk3P7x6p^IS3i3g!<};}e>L9I;6TT)*^JW(2Z2>~QNeVOK&nyh~4ktuXjN&+vj9MMcR;#EoHDQNyez zu5C5QV5(n@tHo@ZbYw^?XUi#*n1m0~u2ho{@~KZMf!EmzB4OoCr5yE|eMNMslLV~_@;We3@xoCJ#F5w+SZC?+_aZEFq6rt ztG6xNGW>_W?>!pa_tp*5xHf#DohSGbywz{PAN>nHg!kD^_LUP}cAs^}tUF%rk9&9b zxqHLj^aEmkN?flk*3johaj`PFleX%Cvs;-6@0!rA(%mcP+Ou?2=G${IY}g>9;c-iEut*?ol64eZePgpaeD5jDh>=?fvIyPm=qs)2-C zvH^Z<$}vY_;h#c_>bzacwDCsvO}ze?{*1w#;?k9M;rPt9*njw&_O>wC^}?pYfs3OoVD;-iK3)#FGrdizuQO!n8p%m z=y|>oo&7-qOIi|d)eDH>w`##6T3V(1p{;Tl2vs15W~dLJm
{{ scan.lot_number }}
{{ scan.item or 'N/A' }}
-
{{ scan.actual_weight }} lbs
+
{{ '%.1f'|format(scan.actual_weight) if scan.actual_weight is not none else '-' }} lbs
{% if scan.duplicate_status == '01' or scan.duplicate_status == '04' %} Duplicate @@ -185,6 +185,23 @@ let currentLotNumber = ''; let isDuplicateConfirmed = false; let isProcessing = false; +function parseWeight(value) { + const num = Number(value); + return Number.isFinite(num) ? num : null; +} + +function formatWeight(value) { + const num = parseWeight(value); + return num === null ? '-' : num.toFixed(1); +} + +function weightsDiffer(actual, expected) { + const actualNum = parseWeight(actual); + const expectedNum = parseWeight(expected); + if (actualNum === null || expectedNum === null) return false; + return Math.abs(actualNum - expectedNum) >= 0.01; +} + // Lot scan handler document.getElementById('lotScanForm').addEventListener('submit', function(e) { e.preventDefault(); @@ -388,7 +405,7 @@ function addScanToList(data, weight) { statusDot = 'orange'; } } else if (data.master_status === 'match') { - if (data.master_expected_weight && Math.abs(weight - data.master_expected_weight) >= 0.01) { + if (data.master_expected_weight && weightsDiffer(weight, data.master_expected_weight)) { statusClass = 'weight_discrepancy'; statusText = 'Weight Off'; statusDot = 'orange'; @@ -414,7 +431,7 @@ function addScanToList(data, weight) { scanRow.innerHTML = `
${currentLotNumber}
${data.item || 'N/A'}
-
${weight} lbs
+
${formatWeight(weight)} lbs
${statusText}
@@ -451,7 +468,7 @@ function displayScanDetail(scan) { // Check for weight discrepancy (Tolerance 0.01) let isWeightOff = false; if (scan.master_status === 'match' && scan.master_expected_weight) { - if (Math.abs(scan.actual_weight - scan.master_expected_weight) >= 0.01) { + if (weightsDiffer(scan.actual_weight, scan.master_expected_weight)) { isWeightOff = true; } } @@ -502,7 +519,7 @@ function displayScanDetail(scan) {
- +