Results printing and saving improced, correct order of tests, etc.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace TBF.Screens
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Disk_SingleWM;
|
||||
public IList<TBF.Forms.ResultItemSpec> RsltItems_Disk_CombinedWM;
|
||||
|
||||
IList<Entities.Test> tests;
|
||||
Entities.Procedure procedure;
|
||||
IList<Entities.TestResult> testResults;
|
||||
bool combined;
|
||||
ListView firstListView;
|
||||
@@ -190,44 +190,11 @@ namespace TBF.Screens
|
||||
return lview;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pre-fetch the test results corresponding to the columns or rows in the ListView
|
||||
/// </summary>
|
||||
/// <returns>Ordered list of test results containing null-s for missing results</returns>
|
||||
IList<Entities.TestResult> GetCurrentTestResults(int meterNr)
|
||||
{
|
||||
IList<Entities.TestResult> rslts = new List<Entities.TestResult>();
|
||||
|
||||
foreach (var test in tests)
|
||||
{
|
||||
if ((test.Part == 0) || (test.Part == meterNr + 1))
|
||||
{
|
||||
for (int rpt = 1; rpt <= test.Repeats; rpt++)
|
||||
{
|
||||
bool added = false;
|
||||
if (testResults != null)
|
||||
{
|
||||
foreach (var testRslt in testResults)
|
||||
{
|
||||
if ((testRslt.TestId == test.Id) && (testRslt.RepetitionNr == rpt) && !testRslt.DoNotPublish)
|
||||
{
|
||||
rslts.Add(testRslt);
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!added) rslts.Add(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rslts;
|
||||
}
|
||||
|
||||
IList<string> GetAllDecoratedTestNames(int meterNr)
|
||||
{
|
||||
IList<string> rslt = new List<string>();
|
||||
foreach (var test in tests)
|
||||
foreach (var test in procedure.Tests)
|
||||
{
|
||||
if ((test.Part == 0) || (test.Part == meterNr + 1))
|
||||
{
|
||||
@@ -253,7 +220,7 @@ namespace TBF.Screens
|
||||
ListView GetResultsTestsAreRows(int mtr)
|
||||
{
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
if (tests == null || items == null) return null;
|
||||
if (procedure == null || procedure.Tests == null || items == null) return null;
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
@@ -282,7 +249,7 @@ namespace TBF.Screens
|
||||
|
||||
IList<string> testNames = GetAllDecoratedTestNames(mtr);
|
||||
int ix = 0;
|
||||
foreach (var testRslt in GetCurrentTestResults(mtr))
|
||||
foreach (var testRslt in Utils.GetSortedTestResults(procedure, testResults, mtr))
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
if (testRslt != null)
|
||||
@@ -333,7 +300,7 @@ namespace TBF.Screens
|
||||
ListView GetResultsTestsAreColumns(int mtr)
|
||||
{
|
||||
IList<Forms.ResultItemSpec> items = (combined ? RsltItems_Screen_CombinedWM : RsltItems_Screen_SingleWM);
|
||||
if (tests == null || items == null) return null;
|
||||
if (procedure == null || procedure.Tests == null || items == null) return null;
|
||||
|
||||
ListView lview = GetListView();
|
||||
|
||||
@@ -360,7 +327,7 @@ namespace TBF.Screens
|
||||
}
|
||||
}
|
||||
|
||||
IList<Entities.TestResult> trs = GetCurrentTestResults(mtr);
|
||||
IList<Entities.TestResult> trs = Utils.GetSortedTestResults(procedure, testResults, mtr);
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
@@ -424,7 +391,7 @@ namespace TBF.Screens
|
||||
|
||||
void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args)
|
||||
{
|
||||
tests = args.Procedure.Tests;
|
||||
procedure = args.Procedure;
|
||||
testResults = new List<Entities.TestResult>();
|
||||
RedrawAll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user