예제 #1
0
        private async Task MergeSpecificationInformationForProviderBatch(SpecificationInformation specificationInformation,
                                                                         IEnumerable <string> providerIds,
                                                                         ConcurrentDictionary <string, FundingPeriod> fundingPeriods)
        {
            LogInformation($"Merging specification information for specification {specificationInformation.Id} into summary for provider batch with length {providerIds.Count()}");

            foreach (string providerId in providerIds)
            {
                LogInformation($"Merging specification information for specification {specificationInformation.Id} into summary for provider {providerId}");

                ProviderWithResultsForSpecifications providerWithResultsForSpecifications = await GetProviderWithResultsByProviderId(providerId);

                providerWithResultsForSpecifications ??= new ProviderWithResultsForSpecifications
                {
                    Provider = new ProviderInformation
                    {
                        Id = providerId
                    }
                };

                await EnsureFundingPeriodEndDateQueried(specificationInformation, fundingPeriods);

                providerWithResultsForSpecifications.MergeSpecificationInformation(specificationInformation);

                if (providerWithResultsForSpecifications.GetIsDirty())
                {
                    await _results.UpsertSpecificationWithProviderResults(providerWithResultsForSpecifications);
                }
            }

            LogInformation($"Completed merging specification information for specification {specificationInformation.Id} into summary for provider batch with length {providerIds.Count()}");
        }