private async Task AddFundingClaimJobs(ReferenceDataIndexModel model, List <SubmittedJob> jobs, CancellationToken cancellationToken) { var fundingClaimsCollectionMetaDataLastUpdate = await _fundingClaimsDatesService.GetLastUpdatedFundingClaimsCollectionMetaDataAsync(cancellationToken); model.CollectionJobStats.Add(CollectionNames.FundingClaimsMetaData, new ReferenceDataIndexBase { LastUpdatedDateTime = GetDate(fundingClaimsCollectionMetaDataLastUpdate?.DateTimeUpdatedUtc), LastUpdatedByWho = fundingClaimsCollectionMetaDataLastUpdate?.CreatedBy ?? DataUnavailable, Valid = true }); }
private void AddDevolvedPostcodesJobs(ReferenceDataIndexModel model, List <SubmittedJob> jobs) { var latestSuccessfulDevolvedPostcodeJob = jobs?.Where( w => w.CollectionName == CollectionNames.DevolvedPostcodesFullName || w.CollectionName == CollectionNames.DevolvedPostcodesLocalAuthority || w.CollectionName == CollectionNames.DevolvedPostcodesOnsOverride || w.CollectionName == CollectionNames.DevolvedPostcodesSof) .OrderByDescending(o => o.DateTimeSubmittedUtc) .FirstOrDefault(); model.CollectionJobStats.Add(CollectionNames.DevolvedPostcodes, new ReferenceDataIndexBase { LastUpdatedDateTime = GetDate(latestSuccessfulDevolvedPostcodeJob?.DateTimeSubmittedUtc), LastUpdatedByWho = latestSuccessfulDevolvedPostcodeJob?.CreatedBy ?? DataUnavailable, Valid = true }); }
public async Task <ReferenceDataIndexModel> GetLatestReferenceDataJobs(CancellationToken cancellationToken) { var jobs = (await _jobService.GetLatestJobForReferenceDataCollectionsAsync(CollectionTypes.ReferenceData, cancellationToken))?.ToList(); var model = new ReferenceDataIndexModel(); foreach (var collection in _collections.Where(w => w.IsDisplayedOnReferenceDataSummary)) { var collectionJobs = jobs?.FirstOrDefault(j => j.CollectionName == collection.CollectionName); model.CollectionJobStats.Add(collection.CollectionName, new ReferenceDataIndexBase { LastUpdatedDateTime = GetDate(collectionJobs?.DateTimeSubmittedUtc), LastUpdatedByWho = collectionJobs?.CreatedBy ?? DataUnavailable, Valid = await IsCollectionValid(collection.CollectionName, cancellationToken) }); } // Special Cases await AddFundingClaimJobs(model, jobs, cancellationToken); AddDevolvedPostcodesJobs(model, jobs); return(model); }