From bb47dd2333102bc37a20f5c4a7fb0b2ccd894d6b Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 17 Sep 2024 10:22:21 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=B3=D0=BE=D0=B2,=20=D0=BE=D0=B1=D0=BD=D0=B0=D1=80?= =?UTF-8?q?=D1=83=D0=B6=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=D1=81?= =?UTF-8?q?=D0=BB=D0=B5=20=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=82=D0=B5=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=20=D1=84=D1=80=D0=BE=D0=BD=D1=82=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Requests/MessageRequest.cs | 8 ++++++++ AsbCloudInfrastructure/Services/MessageService.cs | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/AsbCloudApp/Requests/MessageRequest.cs b/AsbCloudApp/Requests/MessageRequest.cs index f11f6290..6e4410d8 100644 --- a/AsbCloudApp/Requests/MessageRequest.cs +++ b/AsbCloudApp/Requests/MessageRequest.cs @@ -68,6 +68,14 @@ public class MessageRequest : MessageRequestBase /// public IEnumerable IdsWell { get; set; } = null!; + /// + /// + /// + public MessageRequest() + { + + } + /// /// параметры для запроса списка сообщений (с ids скважин) /// diff --git a/AsbCloudInfrastructure/Services/MessageService.cs b/AsbCloudInfrastructure/Services/MessageService.cs index e4a5b333..fe169259 100644 --- a/AsbCloudInfrastructure/Services/MessageService.cs +++ b/AsbCloudInfrastructure/Services/MessageService.cs @@ -43,7 +43,9 @@ public class MessageService : IMessageService var telemetryMessages = await messageRepository.GetMessagesAsync(messageTelemetryRequest, token); var groupedMessages = telemetryMessages.GroupBy(x => new { x.IdTelemetry, x.IdEvent }); - var events = messageTelemetryRequest.Events.ToDictionary(e => e.Id); + var events = messageTelemetryRequest.Events + .GroupBy(e => e.Id) + .ToDictionary(e => e.Key, e => e.FirstOrDefault()); var idsWellsDict = messageTelemetryRequest.Telemetries.ToDictionary(e => e.Id, e => e.IdWell);