From a12790d5ca6241127dbdfea64a7f68e8d29a5a4c Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 24 Jun 2021 13:23:12 +1000 Subject: [PATCH] Fixes table data nesting Sometimes you just need a quick break --- InvenTree/templates/js/stock.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index 06bbb7c20e..b557f0c327 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -179,27 +179,32 @@ function loadStockTestResultsTable(table, options) { var match = false; var override = false; + // Extract the simplified test key var key = item.key; // Attempt to associate this result with an existing test - tableData.forEach(function(row, index) { + for (var idx = 0; idx < tableData.length; idx++) { + + var row = tableData[idx]; if (key == row.key) { item.test_name = row.test_name; item.required = row.required; - match = true; - if (row.result == null) { item.parent = parent_node; - tableData[index] = item; + tableData[idx] = item; override = true; } else { item.parent = row.pk; } + + match = true; + + break; } - }); + } // No match could be found if (!match) {