2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-08-07 04:52:08 +00:00

Display test results

This commit is contained in:
Oliver Walters
2020-05-23 22:52:10 +10:00
parent ec31c26932
commit e89713660b
3 changed files with 164 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
import 'dart:convert';
import 'package:InvenTree/api.dart';
import 'package:InvenTree/inventree/stock.dart';
import 'package:flutter/cupertino.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'model.dart';
import 'dart:io';
@@ -95,6 +97,29 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
return template;
}
bool passFailStatus() {
var result = latestResult();
if (result == null) {
return null;
}
return result.result;
}
// List of test results associated with this template
List<InvenTreeStockItemTestResult> results = [];
// Return the most recent test result recorded against this template
InvenTreeStockItemTestResult latestResult() {
if (results.isEmpty) {
return null;
}
return results.last;
}
}

View File

@@ -18,7 +18,7 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
String get key => jsondata['key'] ?? '';
String get test_name => jsondata['test'] ?? '';
String get testName => jsondata['test'] ?? '';
bool get result => jsondata['result'] ?? false;