Bug fixes in results display in case test parts are used for standard meters, version 1.5.46.

This commit is contained in:
Milan Hanajik
2015-05-23 15:30:31 +02:00
parent 04196fde2f
commit 8de40fbf41
3 changed files with 28 additions and 27 deletions
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.5.45.1")]
[assembly: AssemblyFileVersion("1.5.45.1")]
[assembly: AssemblyVersion("1.5.46.1")]
[assembly: AssemblyFileVersion("1.5.46.1")]
@@ -286,9 +286,11 @@ namespace TBF.Screens
}
}
IList<string> testNames = GetAllDecoratedTestNames(mtr);
int ix = 0;
foreach (var testRslt in Utils.GetSortedTestResults(procedure, testResults, Utils.PartNr(mtr, combined)))
int meterPartNr = Utils.PartNr(mtr, combined);
IList<string> testNames = GetAllDecoratedTestNames(meterPartNr);
IList<Entities.TestResult> sortedResults = Utils.GetSortedTestResults(procedure, testResults, meterPartNr);
int ix = 0;
foreach (var testRslt in sortedResults)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
if (testRslt != null)
@@ -350,7 +352,7 @@ namespace TBF.Screens
{
lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsCombinedClmnCount > 0) ? ls.RsltsCombinedClmnWdths[0] : 40);
int i = 1;
foreach (var str in GetAllDecoratedTestNames(mtr))
foreach (var str in GetAllDecoratedTestNames(Utils.PartNr(mtr, combined)))
{
lview.Columns.Add(str, (ls.RsltsCombinedClmnCount > i) ? ls.RsltsCombinedClmnWdths[i] : 70);
i++;
@@ -360,7 +362,7 @@ namespace TBF.Screens
{
lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsSingleClmnCount > 0) ? ls.RsltsSingleClmnWdths[0] : 40);
int i = 1;
foreach (var str in GetAllDecoratedTestNames(mtr))
foreach (var str in GetAllDecoratedTestNames(Utils.PartNr(mtr, combined)))
{
lview.Columns.Add(str, (ls.RsltsSingleClmnCount > i) ? ls.RsltsSingleClmnWdths[i] : 70);
i++;
+19 -20
View File
@@ -220,31 +220,14 @@ namespace TBF
return rslts;
}
/// <summary>
/// To prepare the last argument of GetSortedTestResults() function
/// </summary>
/// <param name="wmNr1">Watermeter nr. (1-based)</param>
/// <param name="combined">Meter: false=standard, true=combined</param>
/// <returns>Part nr. of the meter</returns>
public static int PartNr(int wmNr1, bool combined)
{
if (wmNr1 == 0) return 0;
if (combined) return wmNr1;
int wmPartSize = (wmNr1 - 1) / Program.LineSize + 1;
return wmPartSize;
}
/// <summary>
/// Pre-fetch the test names given the procedure and the meter number.
/// The order or test names is the same as in the procedure specification.
/// </summary>
/// <param name="procedure">Procedure</param>
/// <param name="meterNr">Water meter number (1-based) or 0=all (also compared with nonzero 'Part' number)</param>
/// <param name="meterPartNr">Water meter number (1-based) or 0=all (also compared with nonzero 'Part' number)</param>
/// <returns>Ordered list of test names</returns>
public static IList<string> GetDecoratedTestNames(Entities.Procedure procedure, int meterNr)
public static IList<string> GetDecoratedTestNames(Entities.Procedure procedure, int meterPartNr)
{
IList<string> names = new List<string>();
@@ -255,7 +238,7 @@ namespace TBF
BenchControl.GenericDevices.ITestMethod method =
BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod;
if ((method != null) && method.Publish && ((test.Part == 0) || (meterNr == 0) || (test.Part == meterNr)))
if ((method != null) && method.Publish && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
{
if (test.Repeats == 1)
{
@@ -271,6 +254,22 @@ namespace TBF
return names;
}
/// <summary>
/// To prepare the last argument of GetSortedTestResults() and GetDecoratedTestNames() functions
/// </summary>
/// <param name="wmNr1">Watermeter nr. (1-based)</param>
/// <param name="combined">Meter: false=standard, true=combined</param>
/// <returns>Part nr. of the meter</returns>
public static int PartNr(int wmNr1, bool combined)
{
if (wmNr1 == 0) return 0;
if (combined) return wmNr1;
int wmPartSize = (wmNr1 - 1) / Program.LineSize + 1;
return wmPartSize;
}
/// <summary>
/// Converts float number to a string with the specified number of valid digits
/// </summary>