From 0235fe00286e52a4dcdad5ac345256e564e6fa59 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Thu, 7 May 2026 14:35:11 +1000 Subject: [PATCH] =?UTF-8?q?fix(core,dal):=20=D0=A3=D1=81=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D1=8B=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=88=D0=BE=D1=80=D1=82=D0=BA=D0=BE=D0=B4=D0=BE=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D1=83=20=D1=81=20?= =?UTF-8?q?Id=2000000000-0000-0000-0000-000000000000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.Core/Services/Shortcodes/ShortcodesService.cs | 3 ++- PARR.DAL/Repositories/TemplateRepository.cs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PARR.Core/Services/Shortcodes/ShortcodesService.cs b/PARR.Core/Services/Shortcodes/ShortcodesService.cs index 8ff84c7e..4a62ec97 100644 --- a/PARR.Core/Services/Shortcodes/ShortcodesService.cs +++ b/PARR.Core/Services/Shortcodes/ShortcodesService.cs @@ -163,7 +163,8 @@ namespace PARR.Core.Services.Shortcodes } // Сохранение в кэш (только если были изменения) - if (!string.IsNullOrEmpty(result) && result != str) + // Нельзя писать template.Id == Guid.Empty, так как id для новых шаблонов 0000-000-000000 и будет не верно реализован шорт-код + if (!string.IsNullOrEmpty(result) && result != str && template.Id != Guid.Empty) { var toCache = new ShortcodesResult { diff --git a/PARR.DAL/Repositories/TemplateRepository.cs b/PARR.DAL/Repositories/TemplateRepository.cs index 11b95ac3..4a81b015 100644 --- a/PARR.DAL/Repositories/TemplateRepository.cs +++ b/PARR.DAL/Repositories/TemplateRepository.cs @@ -161,17 +161,17 @@ namespace PARR.DAL.Repositories var reservedTemplateId = result.FirstOrDefault(); - if (reservedTemplateId != default(Guid)) + if (reservedTemplateId != Guid.Empty) { logger.LogInformation("Успешно зарезервирован шаблон с ID: {TemplateId} для UnitId: {UnitId}", reservedTemplateId, newUnitId); + return reservedTemplateId; } else { logger.LogDebug("Не удалось зарезервировать шаблон для UnitId: {UnitId} (не найдено подходящих конфигураций роботов)", newUnitId); + return null; } - - return reservedTemplateId; } catch (Exception ex) {