diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs
index 2e74d3c4..653b9563 100644
--- a/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs
+++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs
@@ -1,12 +1,11 @@
using System;
-using AsbCloudApp.Data.WellOperation;
namespace AsbCloudApp.Data;
///
/// dto для хранения данных статистики качества бурения
///
-public class DataSaubStatDrillingQualityDto : IId
+public class DataSaubStatDrillingQualityDto : IId, IDataSaubStatDto
{
///
///
diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs
index fc880869..2ec9f959 100644
--- a/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs
+++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs
@@ -6,7 +6,7 @@ namespace AsbCloudApp.Data;
///
/// dto для хранения данных статистики сауб
///
-public class DataSaubStatDto : IId
+public class DataSaubStatDto : IId, IDataSaubStatDto
{
///
///
diff --git a/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs
new file mode 100644
index 00000000..d82e40bb
--- /dev/null
+++ b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace AsbCloudApp.Data;
+
+///
+/// Dto для работы с данными dataSaubStat
+///
+public interface IDataSaubStatDto
+{
+ ///
+ /// Дата и время начала
+ ///
+ public DateTimeOffset DateStart { get; set; }
+
+ ///
+ /// Дата и время окончания
+ ///
+ public DateTimeOffset DateEnd { get; set; }
+}
diff --git a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs
deleted file mode 100644
index 849f44c4..00000000
--- a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using AsbCloudApp.Data;
-using AsbCloudApp.Services;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace AsbCloudApp.Repositories;
-
-///
-/// Репозиторий работы с данными из таблицы t_data_daub_stat_drilling_quality
-///
-public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorService
-{
- ///
- /// Получение записей по ключу телеметрии
- ///
- /// ключ телеметрии
- /// начальная дата
- /// конечная дата
- ///
- ///
- Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
-
- ///
- /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий
- ///
- /// ключи телеметрий
- ///
- ///
- Task> GetLastsAsync(int[] idTelemetries, CancellationToken token);
-
- ///
- /// Вставка записей статистики качества
- ///
- ///
- ///
- ///
- Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token);
-}
diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs
index d419ad82..e854e9ce 100644
--- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs
+++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs
@@ -8,9 +8,10 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Repositories;
///
-/// Репозиторий работы с данными из таблицы t_data_daub_stat
+/// Репозиторий работы с данными, реализующими интерфейс IDataSaubStatDto
///
-public interface IDataSaubStatRepository : ITelemetryDataEditorService
+public interface IDataSaubStatRepository : ITelemetryDataEditorService
+ where TDto : IDataSaubStatDto
{
///
/// Получение записей по ключу телеметрии
@@ -20,21 +21,21 @@ public interface IDataSaubStatRepository : ITelemetryDataEditorService
/// конечная дата
///
///
- Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
+ Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
///
- /// Получение последних по дате окончания бурения записей в разрезе телеметрий
+ /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий
///
/// ключи телеметрий
///
///
- Task> GetLastsAsync(int[] idTelemetries, CancellationToken token);
+ Task> GetLastsAsync(int[] idTelemetries, CancellationToken token);
///
- /// Вставка записей статистики
+ /// Вставка записей статистики качества
///
///
///
///
- Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token);
+ Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token);
}
diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStat.cs b/AsbCloudDb/Model/SaubStat/DataSaubStat.cs
index b4017a8e..39cfc41a 100644
--- a/AsbCloudDb/Model/SaubStat/DataSaubStat.cs
+++ b/AsbCloudDb/Model/SaubStat/DataSaubStat.cs
@@ -7,7 +7,7 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
[Table("t_data_saub_stat"), Comment("Кеш-таблица для хранения данных для РТК-отчета")]
- public class DataSaubStat : IId
+ public class DataSaubStat : IId, IDataSaubStat
{
[Key]
[Column("id")]
diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs
index 6c657a99..f721b45e 100644
--- a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs
+++ b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs
@@ -2,12 +2,11 @@ using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
[Table("t_data_saub_stat_drilling_quality"), Comment("Кеш-таблица для хранения данных для построения страницы \"Качество\"")]
- public class DataSaubStatDrillingQuality : IId
+ public class DataSaubStatDrillingQuality : IId, IDataSaubStat
{
[Key]
[Column("id")]
diff --git a/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs b/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs
new file mode 100644
index 00000000..07c57deb
--- /dev/null
+++ b/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace AsbCloudDb.Model;
+public interface IDataSaubStat
+{
+ public int IdTelemetry { get; set; }
+ public DateTimeOffset DateStart { get; set; }
+ public DateTimeOffset DateEnd { get; set; }
+}
diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
index 80783c73..2246dc54 100644
--- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
+++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
@@ -19,7 +19,7 @@ namespace AsbCloudInfrastructure.Tests.Services;
public class DataSaubStatServiceTest
{
private readonly int Gap = 5;
- private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For();
+ private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>();
private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>();
private readonly IDetectedOperationRepository detectedOperationRepositoryMock = Substitute.For();
private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For();
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index a8137bfe..339f4736 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -318,8 +318,8 @@ public static class DependencyInjection
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient();
- services.AddTransient();
+ services.AddTransient, DataSaubStatRepository>();
+ services.AddTransient, DataSaubStatDrillingQualityRepository>();
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs
new file mode 100644
index 00000000..74000e43
--- /dev/null
+++ b/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs
@@ -0,0 +1,111 @@
+using AsbCloudApp.Repositories;
+using AsbCloudApp.Requests;
+using AsbCloudApp.Services;
+using AsbCloudDb.Model;
+using Mapster;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudInfrastructure.Repository;
+public class DataSaubStatAbstractRepository : IDataSaubStatRepository
+ where TDto : AsbCloudApp.Data.IDataSaubStatDto
+ where TEntity : class, AsbCloudDb.Model.IDataSaubStat
+{
+ private readonly IAsbCloudDbContext db;
+ private readonly ITelemetryService telemetryService;
+
+ public DataSaubStatAbstractRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService)
+ {
+ db = dbContext;
+ this.telemetryService = telemetryService;
+ }
+
+ public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token)
+ {
+ var timeZoneOffsets = idTelemetries
+ .Distinct()
+ .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours));
+
+ var stats = await db.Set()
+ .Where(s => idTelemetries.Contains(s.IdTelemetry))
+ .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First())
+ .ToArrayAsync(token);
+
+ var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry]));
+
+ return result;
+ }
+
+ public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
+ {
+ var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours);
+ var geDateUtc = geDate.ToUniversalTime();
+ var leDateUtc = leDate.ToUniversalTime();
+
+ var stats = await db.Set()
+ .Where(s => s.IdTelemetry == idTelemetry)
+ .Where(s => s.DateStart >= geDateUtc)
+ .Where(s => s.DateEnd <= leDateUtc)
+ .ToArrayAsync(token);
+
+ var result = stats.Select(s => ConvertToDto(s, timeSpan));
+
+ return result;
+ }
+
+ public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token)
+ {
+ var entities = dataSaubStats.Select(data => ConvertToEntity(data));
+ db.Set().AddRange(entities);
+ return await db.SaveChangesAsync(token);
+ }
+
+ private static TDto ConvertToDto(TEntity entity, TimeSpan timeSpan)
+ {
+ var dto = entity.Adapt();
+ dto.DateStart = dto.DateStart.ToOffset(timeSpan);
+ dto.DateEnd = dto.DateEnd.ToOffset(timeSpan);
+
+ return dto;
+ }
+
+ private static TEntity ConvertToEntity(TDto dto)
+ {
+ var entity = dto.Adapt();
+ entity.DateStart = dto.DateStart.ToUniversalTime();
+ entity.DateEnd = dto.DateEnd.ToUniversalTime();
+
+ return entity;
+ }
+
+ private IQueryable BuildQuery(TelemetryPartDeleteRequest request)
+ {
+ var query = db.Set()
+ .Where(o => o.IdTelemetry == request.IdTelemetry);
+
+ if (request.LeDate is not null)
+ {
+ var leDate = request.LeDate.Value.ToUniversalTime();
+ query = query.Where(o => o.DateStart <= leDate);
+ }
+
+ if (request.GeDate is not null)
+ {
+ var geDate = request.GeDate.Value.ToUniversalTime();
+ query = query.Where(o => o.DateEnd >= geDate);
+ }
+
+ return query;
+ }
+
+ public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
+ {
+ var query = BuildQuery(request);
+ db.Set().RemoveRange(query);
+ return await db.SaveChangesAsync(token);
+ }
+}
diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs
index 96cad607..f16c9262 100644
--- a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs
+++ b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs
@@ -1,111 +1,21 @@
using AsbCloudApp.Data;
-using AsbCloudApp.Repositories;
-using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
-using Mapster;
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Repository;
-public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualityRepository
+///
+/// data_saub_stat
+///
+public class DataSaubStatDrillingQualityRepository : DataSaubStatAbstractRepository
{
- private readonly IAsbCloudDbContext db;
- private readonly ITelemetryService telemetryService;
-
- public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService)
{
- db = dbContext;
- this.telemetryService = telemetryService;
- }
- public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token)
- {
- var timeZoneOffsets = idTelemetries
- .Distinct()
- .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours));
-
- var stats = await db.Set()
- .Where(s => idTelemetries.Contains(s.IdTelemetry))
- .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First())
- .ToArrayAsync(token);
-
- var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry]));
-
- return result;
- }
-
- public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
- {
- var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours);
- var geDateUtc = geDate.ToUniversalTime();
- var leDateUtc = leDate.ToUniversalTime();
-
- var stats = await db.Set()
- .Where(s => s.IdTelemetry == idTelemetry)
- .Where(s => s.DateStart >= geDateUtc)
- .Where(s => s.DateEnd <= leDateUtc)
- .ToArrayAsync(token);
-
- var result = stats.Select(s => ConvertToDto(s, timeSpan));
-
- return result;
- }
-
- public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token)
- {
- var entities = dataSaubStats.Select(data => ConvertToEntity(data));
- db.Set().AddRange(entities);
- return await db.SaveChangesAsync(token);
- }
-
- private static DataSaubStatDrillingQualityDto ConvertToDto(DataSaubStatDrillingQuality entity, TimeSpan timeSpan)
- {
- var dto = entity.Adapt();
- dto.DateStart = dto.DateStart.ToOffset(timeSpan);
- dto.DateEnd = dto.DateEnd.ToOffset(timeSpan);
-
- return dto;
- }
-
- private static DataSaubStatDrillingQuality ConvertToEntity(DataSaubStatDrillingQualityDto dto)
- {
- var entity = dto.Adapt();
- entity.DateStart = dto.DateStart.ToUniversalTime();
- entity.DateEnd = dto.DateEnd.ToUniversalTime();
-
- return entity;
- }
-
- private IQueryable BuildQuery(TelemetryPartDeleteRequest request)
- {
- var query = db.Set()
- .Where(o => o.IdTelemetry == request.IdTelemetry);
-
- if (request.LeDate is not null)
- {
- var leDate = request.LeDate.Value.ToUniversalTime();
- query = query.Where(o => o.DateStart <= leDate);
- }
-
- if (request.GeDate is not null)
- {
- var geDate = request.GeDate.Value.ToUniversalTime();
- query = query.Where(o => o.DateEnd >= geDate);
- }
-
- return query;
- }
-
- public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
- {
- var query = BuildQuery(request);
- db.Set().RemoveRange(query);
- return await db.SaveChangesAsync(token);
}
}
diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs
index d8932b28..dbfaa6bd 100644
--- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs
+++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs
@@ -1,112 +1,18 @@
using AsbCloudApp.Data;
-using AsbCloudApp.Repositories;
-using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
-using Mapster;
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Repository;
-public class DataSaubStatRepository : IDataSaubStatRepository
+public class DataSaubStatRepository : DataSaubStatAbstractRepository
{
- private readonly IAsbCloudDbContext db;
- private readonly ITelemetryService telemetryService;
-
- public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService)
{
- db = dbContext;
- this.telemetryService = telemetryService;
}
-
- public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token)
- {
- var timeZoneOffsets = idTelemetries
- .Distinct()
- .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours));
-
- var stats = await db.Set()
- .Where(s => idTelemetries.Contains(s.IdTelemetry))
- .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First())
- .ToArrayAsync(token);
-
- var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry]));
-
- return result;
- }
-
- public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
- {
- var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours);
- var geDateUtc = geDate.ToUniversalTime();
- var leDateUtc = leDate.ToUniversalTime();
-
- var stats = await db.Set()
- .Where(s => s.IdTelemetry == idTelemetry)
- .Where(s => s.DateStart >= geDateUtc)
- .Where(s => s.DateEnd <= leDateUtc)
- .ToArrayAsync(token);
-
- var result = stats.Select(s => ConvertToDto(s, timeSpan));
-
- return result;
- }
-
- public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token)
- {
- var entities = dataSaubStats.Select(data => ConvertToEntity(data));
- db.Set().AddRange(entities);
- return await db.SaveChangesAsync(token);
- }
-
- private static DataSaubStatDto ConvertToDto(DataSaubStat entity, TimeSpan timeSpan)
- {
- var dto = entity.Adapt();
- dto.DateStart = dto.DateStart.ToOffset(timeSpan);
- dto.DateEnd = dto.DateEnd.ToOffset(timeSpan);
-
- return dto;
- }
-
- private static DataSaubStat ConvertToEntity(DataSaubStatDto dto)
- {
- var entity = dto.Adapt();
- entity.DateStart = dto.DateStart.ToUniversalTime();
- entity.DateEnd = dto.DateEnd.ToUniversalTime();
-
- return entity;
- }
-
- private IQueryable BuildQuery(TelemetryPartDeleteRequest request)
- {
- var query = db.Set()
- .Where(o => o.IdTelemetry == request.IdTelemetry);
-
- if (request.LeDate is not null)
- {
- var leDate = request.LeDate.Value.ToUniversalTime();
- query = query.Where(o => o.DateStart <= leDate);
- }
-
- if (request.GeDate is not null)
- {
- var geDate = request.GeDate.Value.ToUniversalTime();
- query = query.Where(o => o.DateEnd >= geDate);
- }
-
- return query;
- }
-
- public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
- {
- var query = BuildQuery(request);
- db.Set().RemoveRange(query);
- return await db.SaveChangesAsync(token);
- }
}
diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
index e4ecf594..14be5340 100644
--- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
+++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
@@ -3,7 +3,6 @@ using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
-using AsbCloudInfrastructure.Services.SAUB;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,14 +14,14 @@ namespace AsbCloudInfrastructure.Services;
public class DataSaubStatDrillingQualityService : IDataSaubStatService
{
- private IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository;
+ private IDataSaubStatRepository dataSaubStatDrillingQualityRepository;
private ITelemetryDataSaubService dataSaubService;
private ITelemetryDataCache telemetryDataCache;
public Dictionary> QualitySettingsForFeedRegulators { get; }
public DataSaubStatDrillingQualityService(
- IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository,
+ IDataSaubStatRepository dataSaubStatDrillingQualityRepository,
ITelemetryDataCache telemetryDataCache,
ITelemetryDataSaubService dataSaubService)
{
@@ -99,7 +98,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
result.AddRange(data);
}
- if(result.Any())
+ if (result.Any())
return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token);
return 0;
@@ -115,7 +114,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
var indexStart = 0;
var indexEnd = 0;
- while (indexEnd < dataSaub.Count())
+ while (indexEnd < dataSaub.Count() - 1)
{
indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator);
if (indexStart < 0)
diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs
index 82ee0416..ab0492d3 100644
--- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs
+++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs
@@ -16,13 +16,13 @@ namespace AsbCloudInfrastructure.Services;
public class DataSaubStatService : IDataSaubStatService
{
- private IDataSaubStatRepository dataSaubStatRepository;
+ private IDataSaubStatRepository dataSaubStatRepository;
private ITelemetryDataCache telemetryDataCache;
private ITelemetryDataSaubService dataSaubService;
private IDetectedOperationRepository detectedOperationRepository;
public DataSaubStatService(
- IDataSaubStatRepository dataSaubStatRepository,
+ IDataSaubStatRepository dataSaubStatRepository,
ITelemetryDataCache telemetryDataCache,
ITelemetryDataSaubService dataSaubService,
IDetectedOperationRepository detectedOperationRepository)
diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs
index cae5bdce..ec166d5d 100644
--- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs
+++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs
@@ -23,7 +23,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
private readonly IWellService wellService;
private readonly IChangeLogRepository processMapPlanRotorRepository;
private readonly IChangeLogRepository processMapPlanSlideRepository;
- private readonly IDataSaubStatRepository dataSaubStatRepository;
+ private readonly IDataSaubStatRepository dataSaubStatRepository;
private readonly IWellOperationRepository wellOperationRepository;
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
private readonly IWellOperationService wellOperationService;
@@ -31,7 +31,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
public ProcessMapReportDrillingService(IWellService wellService,
IChangeLogRepository processMapPlanRotorRepository,
IChangeLogRepository processMapPlanSlideRepository,
- IDataSaubStatRepository dataSaubStatRepository,
+ IDataSaubStatRepository dataSaubStatRepository,
IWellOperationRepository wellOperationRepository,
IWellOperationCategoryRepository wellOperationCategoryRepository,
IWellOperationService wellOperationService
diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs
index 442a68f6..27280426 100644
--- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs
+++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs
@@ -1,3 +1,4 @@
+using AsbCloudApp.Data;
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Data.WITS;
using AsbCloudApp.Repositories;
@@ -35,7 +36,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService
public TelemetryDataEditorService(
ITelemetryDataSaubService dataSaubService,
ITelemetryDataService dataSpinService,
- IDataSaubStatRepository dataSaubStatRepository,
+ IDataSaubStatRepository dataSaubStatRepository,
IMessageRepository messageRepository,
IDrillTestRepository drillTestRepository,
ILimitingParameterRepository limitingParameterRepository,
diff --git a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs
index e69cc692..6d946292 100644
--- a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs
+++ b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs
@@ -10,12 +10,12 @@ namespace AsbCloudWebApi.IntegrationTests.Repository;
public class DataSaubStatRepositoryTest : BaseIntegrationTest
{
- private readonly IDataSaubStatRepository dataSaubStatRepository;
+ private readonly IDataSaubStatRepository dataSaubStatRepository;
public DataSaubStatRepositoryTest(WebAppFactoryFixture factory)
: base(factory)
{
- dataSaubStatRepository = scope.ServiceProvider.GetRequiredService();
+ dataSaubStatRepository = scope.ServiceProvider.GetRequiredService>();
dbContext.CleanupDbSet();
}