From 98c1194e5b5f5db35c7e2b9c52eec1556b41c7eb Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 12 Apr 2018 12:42:11 +0200 Subject: [PATCH] Bug fix in Sequences.MainSeq.RestoreBatchResults. --- Results/DB.cs | 16 ++++++++-------- TBF/BenchControl/Sequences/MainSeq.cs | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Results/DB.cs b/Results/DB.cs index 88b72a71c..ecfea110c 100644 --- a/Results/DB.cs +++ b/Results/DB.cs @@ -296,13 +296,13 @@ namespace Results ISession session = DB.CreateSession(); if (session == null) return null; - TestDataList = session.QueryOver().List(); - ComponentsList = session.QueryOver().List(); - WaterMeterDataList = session.QueryOver().List(); - try { - batches = session.QueryOver() + TestDataList = session.QueryOver().List(); + ComponentsList = session.QueryOver().List(); + WaterMeterDataList = session.QueryOver().List(); + + batches = session.QueryOver() .Where(x => (x.BatchNr == batchNr)) .List(); @@ -315,14 +315,14 @@ namespace Results .Where(x => (x.Batch.Id == batch.Id)) .List(); } - } + + return (batches.Count > 0) ? batches[0] : null; + } catch (Exception exc) { log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message); return null; } - - return (batches.Count > 0) ? batches[0] : null; } } } diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs index e67b4da7c..d2bdc36fe 100644 --- a/TBF/BenchControl/Sequences/MainSeq.cs +++ b/TBF/BenchControl/Sequences/MainSeq.cs @@ -1428,6 +1428,8 @@ namespace TBF.BenchControl.Sequences { Batch oriBatch = Results.DB.LoadBatch(oriBatchNr); + if (oriBatch == null) return; + batchResults.Batch.StartTime = oriBatch.StartTime; foreach (var testRslt in batchResults.Batch.TestRslts)