From c44205273c7a25377008b39503076296766aa75c Mon Sep 17 00:00:00 2001 From: Oliver Walters <oliver.henry.walters@gmail.com> Date: Sun, 24 May 2020 20:05:34 +1000 Subject: [PATCH] Simplify javascript --- InvenTree/templates/js/stock.html | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/InvenTree/templates/js/stock.html b/InvenTree/templates/js/stock.html index 68f1a0c5c5..fd2dd61746 100644 --- a/InvenTree/templates/js/stock.html +++ b/InvenTree/templates/js/stock.html @@ -32,17 +32,6 @@ function noResultBadge() { return `<span class='label label-blue float-right'>{% trans "NO RESULT" %}</span>`; } -function testKey(test_name) { - // Convert test name to a unique key without any illegal chars - - test_name = test_name.trim().toLowerCase(); - test_name = test_name.replace(' ', ''); - - test_name = test_name.replace(/[^0-9a-z]/gi, ''); - - return test_name; -} - function loadStockTestResultsTable(table, options) { /* * Load StockItemTestResult table @@ -177,14 +166,14 @@ function loadStockTestResultsTable(table, options) { var match = false; var override = false; - var key = testKey(item.test); + var key = item.key; // Try to associate this result with a test row tableData.forEach(function(row, index) { // The result matches the test template row - if (key == testKey(row.test_name)) { + if (key == row.key) { // Force the names to be the same! item.test_name = row.test_name;