perf: отключил должности для экономии памяти
Create and publish a Docker image / Publish image (push) Successful in 1m30s

This commit is contained in:
2026-05-04 17:20:50 +03:00
parent a75c952f45
commit 1974f36b24
2 changed files with 25 additions and 24 deletions
@@ -3,7 +3,7 @@ using System.Text.Json;
namespace SfeduSchedule.Services;
public class ModeusEmployeeService(ISchedulerFactory schedulerFactory)
public class ModeusEmployeeService
: IHostedService
{
private Dictionary<string, (string, List<string>)> _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);
+21 -20
View File
@@ -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;
}