mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Simplify javascript
This commit is contained in:
parent
e4d10279fa
commit
c44205273c
@ -32,17 +32,6 @@ function noResultBadge() {
|
|||||||
return `<span class='label label-blue float-right'>{% trans "NO RESULT" %}</span>`;
|
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) {
|
function loadStockTestResultsTable(table, options) {
|
||||||
/*
|
/*
|
||||||
* Load StockItemTestResult table
|
* Load StockItemTestResult table
|
||||||
@ -177,14 +166,14 @@ function loadStockTestResultsTable(table, options) {
|
|||||||
var match = false;
|
var match = false;
|
||||||
var override = false;
|
var override = false;
|
||||||
|
|
||||||
var key = testKey(item.test);
|
var key = item.key;
|
||||||
|
|
||||||
// Try to associate this result with a test row
|
// Try to associate this result with a test row
|
||||||
tableData.forEach(function(row, index) {
|
tableData.forEach(function(row, index) {
|
||||||
|
|
||||||
|
|
||||||
// The result matches the test template row
|
// The result matches the test template row
|
||||||
if (key == testKey(row.test_name)) {
|
if (key == row.key) {
|
||||||
|
|
||||||
// Force the names to be the same!
|
// Force the names to be the same!
|
||||||
item.test_name = row.test_name;
|
item.test_name = row.test_name;
|
||||||
|
Loading…
Reference in New Issue
Block a user