mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 14:16:02 +00:00
Test result bug (#12918)
* [UI] Fix for test results * Display all results in expanded table row * Fix uni ttest
This commit is contained in:
@@ -113,20 +113,26 @@ export default function StockItemTestResultTable({
|
|||||||
// Iterate through the returned records
|
// Iterate through the returned records
|
||||||
// Sort test results using the same priority as the backend:
|
// Sort test results using the same priority as the backend:
|
||||||
// finished_datetime -> started_datetime -> date -> pk
|
// finished_datetime -> started_datetime -> date -> pk
|
||||||
records.toSorted(compareTestResults).forEach((record) => {
|
// Note: compareTestResults sorts newest-first, but we need to iterate
|
||||||
// Find matching template
|
// oldest-first here, so that the most recent result is processed last
|
||||||
const idx = results.findIndex(
|
// and ends up displayed as the primary result for its template.
|
||||||
(r: any) => r.templateId == record.template
|
records
|
||||||
);
|
.toSorted(compareTestResults)
|
||||||
if (idx >= 0) {
|
.toReversed()
|
||||||
results[idx] = {
|
.forEach((record) => {
|
||||||
...results[idx],
|
// Find matching template
|
||||||
...record
|
const idx = results.findIndex(
|
||||||
};
|
(r: any) => r.templateId == record.template
|
||||||
|
);
|
||||||
|
if (idx >= 0) {
|
||||||
|
results[idx] = {
|
||||||
|
...results[idx],
|
||||||
|
...record
|
||||||
|
};
|
||||||
|
|
||||||
results[idx].results.push(record);
|
results[idx].results.push(record);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
},
|
},
|
||||||
@@ -464,7 +470,7 @@ export default function StockItemTestResultTable({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = record?.results ?? [];
|
const results = record?.results?.toReversed() ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable
|
<DataTable
|
||||||
@@ -472,7 +478,7 @@ export default function StockItemTestResultTable({
|
|||||||
idAccessor={'test'}
|
idAccessor={'test'}
|
||||||
noHeader
|
noHeader
|
||||||
columns={cols}
|
columns={cols}
|
||||||
records={results.slice(0, -1)}
|
records={results}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -441,12 +441,19 @@ test('Settings - Admin - Parameter', async ({ browser }) => {
|
|||||||
await loadTab(page, 'Selection Lists');
|
await loadTab(page, 'Selection Lists');
|
||||||
|
|
||||||
// Check for expected entry
|
// Check for expected entry
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'table-search-input' })
|
||||||
|
.fill('Animals');
|
||||||
await page.getByRole('cell', { name: 'Animals', exact: true }).waitFor();
|
await page.getByRole('cell', { name: 'Animals', exact: true }).waitFor();
|
||||||
await page.getByText('Various animals and descriptions thereof').waitFor();
|
await page.getByText('Various animals and descriptions thereof').waitFor();
|
||||||
|
|
||||||
await page.waitForLoadState('networkidle');
|
await page.waitForLoadState('networkidle');
|
||||||
await page.waitForTimeout(250);
|
await page.waitForTimeout(250);
|
||||||
|
|
||||||
|
await page.getByRole('textbox', { name: 'table-search-input' }).fill('some');
|
||||||
|
await page.waitForTimeout(500);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
// Clean old list data if exists
|
// Clean old list data if exists
|
||||||
await page
|
await page
|
||||||
.getByRole('cell', { name: 'some list' })
|
.getByRole('cell', { name: 'some list' })
|
||||||
|
|||||||
Reference in New Issue
Block a user