fix(api): AgentTask.GetByIp, задание агенту можно выдавать если есть хоть одно поле AgentName || AgentScript

This commit is contained in:
Mikhail Trubnikov
2023-11-28 12:16:12 +10:00
parent 52c40e3733
commit 00e034edf5

View File

@@ -92,17 +92,17 @@ namespace PARR.API.Controllers.V1
continue; continue;
} }
if (string.IsNullOrEmpty(template.ApplicationsInWork.AgentName) || string.IsNullOrEmpty(template.ApplicationsInWork.AgentScript)) if (string.IsNullOrEmpty(template.ApplicationsInWork.AgentName) && string.IsNullOrEmpty(template.ApplicationsInWork.AgentScript))
{ {
logger.LogWarning($"Запросили задание для агента с пустыми значениями AgentName || AgentScript. Такого не должно быть! " + logger.LogWarning($"Запросили задание для агента с пустыми значениями AgentName && AgentScript. Такого не должно быть! " +
$"ApplicationInWorkId: {template.ApplicationInWorkId}, AgentName: {template.ApplicationsInWork.AgentName}, AgentScript: {template.ApplicationsInWork.AgentScript} , ip: {ip}, date: {date}"); $"ApplicationInWorkId: {template.ApplicationInWorkId}, AgentName: {template.ApplicationsInWork.AgentName}, AgentScript: {template.ApplicationsInWork.AgentScript} , ip: {ip}, date: {date}");
continue; continue;
} }
templateSchedule.ForEach(item => response.Scheduled.Add(new AgentTaskMinScheduleResponse templateSchedule.ForEach(item => response.Scheduled.Add(new AgentTaskMinScheduleResponse
{ {
Name = template.ApplicationsInWork!.AgentName, Name = template.ApplicationsInWork!.AgentName ?? "",
Script = template.ApplicationsInWork!.AgentScript, Script = template.ApplicationsInWork!.AgentScript ?? "",
StartAt = item, StartAt = item,
TemplateId = template.Id TemplateId = template.Id
})); }));