diff --git a/back/Infrastructure/Repositories/SpendingGroupRepo.cs b/back/Infrastructure/Repositories/SpendingGroupRepo.cs index a04ee9b..7d96e7b 100644 --- a/back/Infrastructure/Repositories/SpendingGroupRepo.cs +++ b/back/Infrastructure/Repositories/SpendingGroupRepo.cs @@ -70,7 +70,7 @@ public class SpendingGroupRepo : ISpendingGroupRepo var group = await context.SpendingGroups .AsNoTracking() .Where(x => x.Id == plan.SpendingGroupId) - .Include(x => x.ChangeRecords + .Include(x => x.ChangeRecords! // Выбираем из них только те, которые попадают в диапазон дат плана .Where(cg => cg.ChangedAt >= plan.StartAt && cg.ChangedAt <= plan.EndAt) // И сортируем их по дате diff --git a/back/Infrastructure/Support/Mappers/ChangeRecordMapper.cs b/back/Infrastructure/Support/Mappers/ChangeRecordMapper.cs index cd5d76e..3f7a57a 100644 --- a/back/Infrastructure/Support/Mappers/ChangeRecordMapper.cs +++ b/back/Infrastructure/Support/Mappers/ChangeRecordMapper.cs @@ -12,7 +12,8 @@ public static class ChangeRecordMapper Sum = changeRecord.Sum, ChangedAt = changeRecord.ChangedAt, SpendingGroupId = changeRecord.SpendingGroupId, - UserId = changeRecord.UserId + UserId = changeRecord.UserId, + SpendingGroupName = changeRecord.SpendingGroup?.Name ?? string.Empty }; public static ChangeRecord ToModel(this ChangeRecordDto changeRecord)