Skip to content

Commit

Permalink
only set cohort list when a cohort exists, otherwise get a list of 1 …
Browse files Browse the repository at this point in the history
…null which breaks some rules expecting none
cofaulco committed Jul 13, 2022
1 parent f0dc8f1 commit f285af6
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using AutoMapper;
using MediatR;
using SFA.DAS.Authorization.Services;
using SFA.DAS.Common.Domain.Types;
using SFA.DAS.EAS.Account.Api.Client;
using SFA.DAS.EmployerAccounts.Configuration;
using SFA.DAS.EmployerAccounts.Interfaces;
using SFA.DAS.EmployerAccounts.Models.CommitmentsV2;
using SFA.DAS.EmployerAccounts.Queries.GetSingleCohort;
using SFA.DAS.EmployerAccounts.Models.Recruit;
using SFA.DAS.EmployerAccounts.Queries.GetApprenticeship;
using SFA.DAS.EmployerAccounts.Queries.GetReservations;
using SFA.DAS.EmployerAccounts.Web.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using SFA.DAS.EmployerAccounts.Queries.GetSingleCohort;
using SFA.DAS.EmployerAccounts.Queries.GetVacancies;
using SFA.DAS.EmployerAccounts.Models.Recruit;
using ResourceNotFoundException = SFA.DAS.EmployerAccounts.Web.Exceptions.ResourceNotFoundException;
using SFA.DAS.Common.Domain.Types;
using SFA.DAS.EmployerAccounts.Web.Models;
using SFA.DAS.EmployerAccounts.Web.ViewModels;
using SFA.DAS.NLog.Logger;
using SFA.DAS.EmployerAccounts.Configuration;

namespace SFA.DAS.EmployerAccounts.Web.Orchestrators
{
@@ -40,7 +38,7 @@ public EmployerTeamOrchestratorWithCallToAction(
IMapper mapper,
ICookieStorageService<AccountContext> accountContext,
ILog logger,
EmployerAccountsConfiguration configuration)
EmployerAccountsConfiguration configuration)
: base(mediator, currentDateTime, accountApiClient, mapper, configuration)
{
_employerTeamOrchestrator = employerTeamOrchestrator;
@@ -166,10 +164,9 @@ private async Task<OrchestratorResponse<CallToActionViewModel>> GetCallToAction(
Vacancies = _mapper.Map<IEnumerable<Vacancy>, IEnumerable<VacancyViewModel>>(vacanciesResponse.Vacancies)
},
Apprenticeships = _mapper.Map<IEnumerable<Apprenticeship>, IEnumerable<ApprenticeshipViewModel>>(apprenticeshipsResponse?.Apprenticeships),
Cohorts = new List<CohortViewModel>
{
_mapper.Map<Cohort, CohortViewModel>(accountCohortResponse.Cohort)
}
Cohorts = accountCohortResponse.Cohort != null
? new List<CohortViewModel> { _mapper.Map<Cohort, CohortViewModel>(accountCohortResponse.Cohort) }
: new List<CohortViewModel>()
};
}

0 comments on commit f285af6

Please sign in to comment.