From 1974f36b24b2de8597ae1c88a2652e6b84b4fe0b Mon Sep 17 00:00:00 2001 From: Sergey Karmanov Date: Mon, 4 May 2026 17:20:50 +0300 Subject: [PATCH] =?UTF-8?q?perf:=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B4=D0=BE=D0=BB=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=8D=D0=BA=D0=BE=D0=BD=D0=BE?= =?UTF-8?q?=D0=BC=D0=B8=D0=B8=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ModeusEmployeeService.cs | 8 ++-- SfeduSchedule/Services/ModeusService.cs | 41 ++++++++++--------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/SfeduSchedule/Services/ModeusEmployeeService.cs b/SfeduSchedule/Services/ModeusEmployeeService.cs index 0baa53f..9121ac1 100644 --- a/SfeduSchedule/Services/ModeusEmployeeService.cs +++ b/SfeduSchedule/Services/ModeusEmployeeService.cs @@ -3,7 +3,7 @@ using System.Text.Json; namespace SfeduSchedule.Services; -public class ModeusEmployeeService(ISchedulerFactory schedulerFactory) +public class ModeusEmployeeService : IHostedService { private Dictionary)> _employees = []; // ФИО (ИД, Список должностей) @@ -18,14 +18,14 @@ public class ModeusEmployeeService(ISchedulerFactory schedulerFactory) .OrderBy(e => e.Key) .Take(size) .ToDictionary(e => e.Key, e => e.Value); - + return _employees .Where(e => e.Key.Contains(fullname, StringComparison.OrdinalIgnoreCase)) .OrderBy(e => e.Key) .Take(size) .ToDictionary(e => e.Key, e => e.Value); } - + public bool IsInitialized() { return _employees.Count > 0; @@ -70,7 +70,7 @@ public class ModeusEmployeeService(ISchedulerFactory schedulerFactory) private async Task LoadEmployeesFromDisk() { - + if (File.Exists(_employeesFilePath)) { var json = await File.ReadAllTextAsync(_employeesFilePath); diff --git a/SfeduSchedule/Services/ModeusService.cs b/SfeduSchedule/Services/ModeusService.cs index 7438734..4d2ca53 100644 --- a/SfeduSchedule/Services/ModeusService.cs +++ b/SfeduSchedule/Services/ModeusService.cs @@ -233,21 +233,22 @@ public class ModeusService( } } - var position = (e.GroupName ?? string.Empty).Trim(); - - static string FormatDateRange(string? dateIn, string? dateOut) - { - var start = (dateIn ?? string.Empty).Trim(); - if (string.IsNullOrEmpty(start)) start = "?"; - - var end = (dateOut ?? string.Empty).Trim(); - if (string.IsNullOrEmpty(end)) end = "по наст.вр."; - - return $"{start}–{end}"; - } - - var dateRange = FormatDateRange(e.DateIn, e.DateOut); - var positionWithDates = string.IsNullOrEmpty(position) ? $"({dateRange})" : $"{position} ({dateRange})"; + // Отключено так как информация нигде не используется + // var position = (e.GroupName ?? string.Empty).Trim(); + // + // static string FormatDateRange(string? dateIn, string? dateOut) + // { + // var start = (dateIn ?? string.Empty).Trim(); + // if (string.IsNullOrEmpty(start)) start = "?"; + // + // var end = (dateOut ?? string.Empty).Trim(); + // if (string.IsNullOrEmpty(end)) end = "по наст.вр."; + // + // return $"{start}–{end}"; + // } + // + // var dateRange = FormatDateRange(e.DateIn, e.DateOut); + // var positionWithDates = string.IsNullOrEmpty(position) ? $"({dateRange})" : $"{position} ({dateRange})"; // Место работы с датой if (!grouped.TryGetValue(fullName, out var entry)) { @@ -260,11 +261,11 @@ public class ModeusService( entry.PersonId = personId; } } - - if (!entry.Positions.Contains(positionWithDates)) - { - entry.Positions.Add(positionWithDates); - } + + // if (!entry.Positions.Contains(positionWithDates)) + // { + // entry.Positions.Add(positionWithDates); + // } grouped[fullName] = entry; }