Bug fix in Sequences.MainSeq.RestoreBatchResults.

This commit is contained in:
Milan Hanajik
2018-04-12 12:42:11 +02:00
parent 85f2f31469
commit 98c1194e5b
2 changed files with 10 additions and 8 deletions
+8 -8
View File
@@ -296,13 +296,13 @@ namespace Results
ISession session = DB.CreateSession(); ISession session = DB.CreateSession();
if (session == null) return null; if (session == null) return null;
TestDataList = session.QueryOver<TestData>().List();
ComponentsList = session.QueryOver<Components>().List();
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
try try
{ {
batches = session.QueryOver<Batch>() TestDataList = session.QueryOver<TestData>().List();
ComponentsList = session.QueryOver<Components>().List();
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNr)) .Where(x => (x.BatchNr == batchNr))
.List(); .List();
@@ -315,14 +315,14 @@ namespace Results
.Where(x => (x.Batch.Id == batch.Id)) .Where(x => (x.Batch.Id == batch.Id))
.List(); .List();
} }
}
return (batches.Count > 0) ? batches[0] : null;
}
catch (Exception exc) catch (Exception exc)
{ {
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message); log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
return null; return null;
} }
return (batches.Count > 0) ? batches[0] : null;
} }
} }
} }
+2
View File
@@ -1428,6 +1428,8 @@ namespace TBF.BenchControl.Sequences
{ {
Batch oriBatch = Results.DB.LoadBatch(oriBatchNr); Batch oriBatch = Results.DB.LoadBatch(oriBatchNr);
if (oriBatch == null) return;
batchResults.Batch.StartTime = oriBatch.StartTime; batchResults.Batch.StartTime = oriBatch.StartTime;
foreach (var testRslt in batchResults.Batch.TestRslts) foreach (var testRslt in batchResults.Batch.TestRslts)