From b022a4c1cbf88cc3463f04275f4c7bbeb74e9007 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Thu, 9 Sep 2021 12:55:13 +0500 Subject: [PATCH] Fixed return of .DepthToInterval() analytics method --- AsbCloudDb/Model/AsbCloudDbContext.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index bdcb8443..39952e02 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -378,23 +378,22 @@ namespace AsbCloudDb.Model Database.OpenConnection(); using var reader = await command.ExecuteReaderAsync(token); - IEnumerable<(double? MinDepth, double? MaxDepth, DateTime BeginPeriodDate)> GetResult(DbDataReader rd) + var result = new List<(double? MinDepth, double? MaxDepth, DateTime BeginPeriodDate)>(); + + if (reader.HasRows) { - if (rd.HasRows) + while (reader.Read()) { - while (reader.Read()) - { - yield return - ( - (double?)reader.GetValue(0), - (double?)reader.GetValue(1), - (DateTime)reader.GetValue(2) - ); - } + result.Add( + ( + (double?)reader.GetValue(0), + (double?)reader.GetValue(1), + (DateTime)reader.GetValue(2) + )); } } - return GetResult(reader); + return result; } public async Task CreatePartitionAsync(string propertyName, int id, CancellationToken token = default)