private string GetNewValue(Deal deal, KaskoModificationsInBasket modification) { if…
- User
private string GetNewValue(Deal deal, KaskoModificationsInBasket modification) { if ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.PersonNameOrBirthDateChange && modification.ChangePath == "Driver.Subject.IndividualEntity.Person.LastName") { var driversNames = deal.AutoDeal.Drivers.Select(d => d.Subject.IndividualEntity.Person.GetFullName()).ToList(); return string.Join(", ", driversNames); }
codeif ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.PersonNameOrBirthDateChange && modification.ChangePath == "Insurant.Subject.IndividualEntity.Person.LastName") { var insurant = deal.GetInsurantPerson(); return insurant.GetFullName(); } if ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.PersonNameOrBirthDateChange && modification.ChangePath == "Owner.Subject.IndividualEntity.Person.LastName") { var owner = deal.GetOwner(); return owner.GetPerson().GetFullName(); } if ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.InsurantOwnerIdentityDocumentChange) { var identityDocument = modification.ChangePath.Contains(nameof(deal.Insurant)) ? deal.Insurant.IdentityDocument : deal.GetOwner().IdentityDocument; return $"Серия: {identityDocument?.Series} №: {identityDocument?.Number} дата выдачи: {identityDocument?.DateIssue?.ToString("dd.MM.yyyy")}"; } if ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.AutoTsIdentityCardChange) { var tsIdentityCard = deal.AutoDeal.TsIdentityCard; return $"Серия: {tsIdentityCard?.Series} №: {tsIdentityCard?.Number}{(tsIdentityCard?.DateOfIssued != null ? $" дата выдачи: {tsIdentityCard.DateOfIssued.Value.ToString("dd.MM.yyyy")}" : string.Empty)}"; } return _pathManager.GetValueByPath(deal, ModifyPath(modification.ChangePath)).ToString(); - Assistant
Проблема, которую вы описали, связана с генерацией строки с фамилиями водителей в методе
GetNewValue. Если вы хотите отобразить только одну строку с измененными ФИО через запятую или в каждой новой строке только одно ФИО, вам нужно внести изменения в существующий код.Вот пример, как это можно сделать:
1. Только одна строка с измененными ФИО через запятую.
Если вы хотите, чтобы вывод был в формате одной строки с ФИО, разделенными запятыми:
Нужно всего лишь исправить построение строки в методе :
- User
мне надо исправить если ((KaskoModificationCodes)modification.ModificationListForKaskoCode == KaskoModificationCodes.PersonNameOrBirthDateChange && modification.ChangePath == "Driver.Subject.IndividualEntity.Person.LastName") то только 1 раз выполнять return string.Join(", ", driversNames); То есть если мы уже возвращали значение то больше не надо, даже если в modifications.Where несколько изменений с путем "Driver.Subject.IndividualEntity.Person.LastName"
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.