private object PopulateProvider(ProviderSummary providerSummary, PropertyInfo providerSetter) { Type type = providerSetter.PropertyType; object data = Activator.CreateInstance(type); foreach (PropertyInfo property in type.GetProperties().Where(x => x.CanWrite).ToArray()) { switch (property.Name) { case "DateOpened": property.SetValue(data, providerSummary.DateOpened.HasValue ? providerSummary.DateOpened.Value.Date : (DateTime?)null); break; case "ProviderType": property.SetValue(data, providerSummary.ProviderType.EmptyIfNull()); break; case "ProviderSubType": property.SetValue(data, providerSummary.ProviderSubType.EmptyIfNull()); break; case "Name": property.SetValue(data, providerSummary.Name.EmptyIfNull()); break; case "UKPRN": property.SetValue(data, providerSummary.UKPRN.EmptyIfNull()); break; case "URN": property.SetValue(data, providerSummary.URN.EmptyIfNull()); break; case "UPIN": property.SetValue(data, providerSummary.UPIN.EmptyIfNull()); break; case "DfeEstablishmentNumber": property.SetValue(data, providerSummary.DfeEstablishmentNumber.EmptyIfNull()); break; case "EstablishmentNumber": property.SetValue(data, providerSummary.EstablishmentNumber.EmptyIfNull()); break; case "LegalName": property.SetValue(data, providerSummary.LegalName.EmptyIfNull()); break; case "Authority": property.SetValue(data, providerSummary.Authority.EmptyIfNull()); break; case "DateClosed": property.SetValue(data, providerSummary.DateClosed.HasValue ? providerSummary.DateClosed.Value.Date : (DateTime?)null); break; case "LACode": property.SetValue(data, providerSummary.LACode.EmptyIfNull()); break; case "CrmAccountId": property.SetValue(data, providerSummary.CrmAccountId.EmptyIfNull()); break; case "NavVendorNo": property.SetValue(data, providerSummary.NavVendorNo.EmptyIfNull()); break; case "Status": property.SetValue(data, providerSummary.Status.EmptyIfNull()); break; case "PhaseOfEducation": property.SetValue(data, providerSummary.PhaseOfEducation.EmptyIfNull()); break; default: break; } } return(data); }
public void CalculateProviderResult_WhenCalculationsAreNotEmpty_ShouldReturnCorrectResult() { // Arrange List <Reference> policySpecificationsForFundingCalc = new List <Reference>() { new Reference("Spec1", "SpecOne"), new Reference("Spec2", "SpecTwo") }; List <Reference> policySpecificationsForNumberCalc = new List <Reference>() { new Reference("Spec1", "SpecOne"), }; Reference allocationLineReturned = new Reference("allocationLine", "allocation line for Funding Calc and number calc"); Reference fundingCalcReference = new Reference("CalcF1", "Funding calc 1"); Reference fundingCalcSpecificationReference = new Reference("FSpect", "FundingSpecification"); Reference numbercalcReference = new Reference("CalcF2", "Funding calc 2"); Reference numbercalcSpecificationReference = new Reference("FSpec2", "FundingSpecification2"); CalculationResult fundingCalcReturned = new CalculationResult() { CalculationType = CalculationType.Funding, Calculation = fundingCalcReference, AllocationLine = allocationLineReturned, CalculationSpecification = fundingCalcSpecificationReference, PolicySpecifications = policySpecificationsForFundingCalc, Value = 10000 }; CalculationResult fundingCalcReturned2 = new CalculationResult() { CalculationType = CalculationType.Funding, Calculation = numbercalcReference, AllocationLine = allocationLineReturned, CalculationSpecification = numbercalcSpecificationReference, PolicySpecifications = policySpecificationsForNumberCalc, Value = 20000 }; List <CalculationResult> calculationResults = new List <CalculationResult>() { fundingCalcReturned, fundingCalcReturned2 }; IAllocationModel mockAllocationModel = Substitute.For <IAllocationModel>(); mockAllocationModel .Execute(Arg.Any <List <ProviderSourceDataset> >(), Arg.Any <ProviderSummary>()) .Returns(calculationResults); CalculationEngine calculationEngine = CreateCalculationEngine(); ProviderSummary providerSummary = CreateDummyProviderSummary(); BuildProject buildProject = CreateBuildProject(); var nonMatchingCalculationModel = new CalculationSummaryModel() { Id = "Non matching calculation", Name = "Non matching calculation", CalculationType = CalculationType.Funding }; IEnumerable <CalculationSummaryModel> calculationSummaryModels = new[] { new CalculationSummaryModel() { Id = fundingCalcReference.Id, Name = fundingCalcReference.Name, CalculationType = CalculationType.Funding }, new CalculationSummaryModel() { Id = numbercalcReference.Id, Name = numbercalcReference.Name, CalculationType = CalculationType.Funding }, nonMatchingCalculationModel }; // Act var calculateProviderResults = calculationEngine.CalculateProviderResults(mockAllocationModel, buildProject, calculationSummaryModels, providerSummary, new List <ProviderSourceDataset>()); ProviderResult result = calculateProviderResults; // Assert result.Provider.Should().Be(providerSummary); result.SpecificationId.Should().BeEquivalentTo(buildProject.SpecificationId); result.Id.Should().BeEquivalentTo(GenerateId(providerSummary.Id, buildProject.SpecificationId)); result.CalculationResults.Should().HaveCount(3); result.AllocationLineResults.Should().HaveCount(1); AllocationLineResult allocationLine = result.AllocationLineResults[0]; allocationLine.Value = 30000; CalculationResult fundingCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == fundingCalcReference.Id); fundingCalcResult.Calculation.Should().BeEquivalentTo(fundingCalcReference); fundingCalcResult.CalculationType.Should().BeEquivalentTo(fundingCalcReturned.CalculationType); fundingCalcResult.AllocationLine.Should().BeEquivalentTo(allocationLineReturned); fundingCalcResult.CalculationSpecification.Should().BeEquivalentTo(fundingCalcSpecificationReference); fundingCalcResult.PolicySpecifications.Should().BeEquivalentTo(policySpecificationsForFundingCalc); fundingCalcResult.Value.Should().Be(fundingCalcReturned.Value.Value); CalculationResult numberCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == numbercalcReference.Id); numberCalcResult.Calculation.Should().BeEquivalentTo(numbercalcReference); numberCalcResult.CalculationType.Should().BeEquivalentTo(fundingCalcReturned2.CalculationType); numberCalcResult.AllocationLine.Should().BeEquivalentTo(allocationLineReturned); numberCalcResult.CalculationSpecification.Should().BeEquivalentTo(numbercalcSpecificationReference); numberCalcResult.PolicySpecifications.Should().BeEquivalentTo(policySpecificationsForNumberCalc); numberCalcResult.Value.Should().Be(fundingCalcReturned2.Value.Value); CalculationResult nonMatchingCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == "Non matching calculation"); nonMatchingCalcResult.Calculation.Should().BeEquivalentTo(new Reference(nonMatchingCalculationModel.Id, nonMatchingCalculationModel.Name)); nonMatchingCalcResult.CalculationType.Should().BeEquivalentTo(nonMatchingCalculationModel.CalculationType); nonMatchingCalcResult.AllocationLine.Should().BeNull(); nonMatchingCalcResult.CalculationSpecification.Should().BeNull(); nonMatchingCalcResult.PolicySpecifications.Should().BeNull(); nonMatchingCalcResult.Value.Should().BeNull(); }
public ProviderResult CalculateProviderResults(IAllocationModel model, BuildProject buildProject, IEnumerable <CalculationSummaryModel> calculations, ProviderSummary provider, IEnumerable <ProviderSourceDataset> providerSourceDatasets, IEnumerable <CalculationAggregation> aggregations = null) { var stopwatch = new Stopwatch(); stopwatch.Start(); IEnumerable <CalculationResult> calculationResults = model.Execute(providerSourceDatasets != null ? providerSourceDatasets.ToList() : new List <ProviderSourceDataset>(), provider, aggregations).ToArray(); var providerCalResults = calculationResults.ToDictionary(x => x.Calculation?.Id); stopwatch.Stop(); if (providerCalResults.Count > 0) { _logger.Debug($"{providerCalResults.Count} calcs in {stopwatch.ElapsedMilliseconds}ms ({stopwatch.ElapsedMilliseconds / providerCalResults.Count: 0.0000}ms)"); } else { _logger.Information("There are no calculations to executed for specification ID {specificationId}", buildProject.SpecificationId); } ProviderResult providerResult = new ProviderResult { Provider = provider, SpecificationId = buildProject.SpecificationId }; byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes($"{providerResult.Provider.Id}-{providerResult.SpecificationId}"); providerResult.Id = Convert.ToBase64String(plainTextBytes); List <CalculationResult> results = new List <CalculationResult>(); if (calculations != null) { foreach (CalculationSummaryModel calculation in calculations) { CalculationResult result = new CalculationResult { Calculation = calculation.GetReference(), CalculationType = calculation.CalculationType, Version = calculation.Version }; if (providerCalResults.TryGetValue(calculation.Id, out CalculationResult calculationResult)) { result.CalculationSpecification = calculationResult.CalculationSpecification; if (calculationResult.AllocationLine != null) { result.AllocationLine = calculationResult.AllocationLine; } result.PolicySpecifications = calculationResult.PolicySpecifications; // The default for the calculation is to return Decimal.MinValue - if this is the case, then subsitute a 0 value as the result, instead of the negative number. if (calculationResult.Value != decimal.MinValue) { result.Value = calculationResult.Value; } else { result.Value = 0; } result.ExceptionType = calculationResult.ExceptionType; result.ExceptionMessage = calculationResult.ExceptionMessage; } results.Add(result); } } providerResult.CalculationResults = results.ToList(); providerResult.AllocationLineResults = results.Where(x => x.CalculationType == CalculationType.Funding && x.AllocationLine != null) .GroupBy(x => x.AllocationLine).Select(x => new AllocationLineResult { AllocationLine = x.Key, Value = x.All(v => !v.Value.HasValue) ? (decimal?)null : x.Sum(v => v.Value ?? decimal.Zero) }).ToList(); return(providerResult); }
public IEnumerable <CalculationResult> Execute(List <ProviderSourceDataset> datasets, ProviderSummary providerSummary, IEnumerable <CalculationAggregation> aggregationValues = null) { HashSet <string> datasetNamesUsed = new HashSet <string>(); foreach (ProviderSourceDataset dataset in datasets) { Type type = null; if (_featureToggle.IsUseFieldDefinitionIdsInSourceDatasetsEnabled()) { if (!string.IsNullOrWhiteSpace(dataset.DataDefinitionId)) { type = GetDatasetType(dataset.DataDefinitionId); } else { type = GetDatasetType(dataset.DataDefinition.Id); } } else { type = GetDatasetType(dataset.DataDefinition.Name); } if (_datasetSetters.TryGetValue(dataset.DataRelationship.Name, out PropertyInfo setter)) { datasetNamesUsed.Add(dataset.DataRelationship.Name); if (dataset.DataGranularity == DataGranularity.SingleRowPerProvider) { object row = PopulateRow(type, dataset.Current.Rows.First()); setter.SetValue(_datasetsInstance, row); } else { Type constructGeneric = typeof(List <>).MakeGenericType(type); object list = Activator.CreateInstance(constructGeneric); MethodInfo addMethod = list.GetType().GetMethod("Add"); Type itemType = list.GetType().GenericTypeArguments.First(); object[] rows = dataset.Current.Rows.Select(x => PopulateRow(itemType, x)).ToArray(); foreach (object row in rows) { addMethod.Invoke(list, new[] { row }); } setter.SetValue(_datasetsInstance, list); } } } PropertyInfo providerSetter = _instance.GetType().GetProperty("Provider"); object provider = PopulateProvider(providerSummary, providerSetter); providerSetter.SetValue(_instance, provider); if (!aggregationValues.IsNullOrEmpty()) { PropertyInfo aggregationsSetter = _instance.GetType().GetProperty("Aggregations"); if (aggregationsSetter != null) { Type propType = aggregationsSetter.PropertyType; object data = Activator.CreateInstance(propType); MethodInfo add = data.GetType().GetMethod("Add", new[] { typeof(String), typeof(Decimal) }); foreach (CalculationAggregation aggregations in aggregationValues) { foreach (AggregateValue aggregatedValue in aggregations.Values) { add.Invoke(data, new object[] { aggregatedValue.FieldReference, aggregatedValue.Value.HasValue ? aggregatedValue.Value.Value : 0 }); } } aggregationsSetter.SetValue(_instance, data); } } // Add default object for any missing datasets to help reduce null exceptions foreach (string key in _datasetSetters.Keys.Where(x => !datasetNamesUsed.Contains(x))) { if (_datasetSetters.TryGetValue(key, out PropertyInfo setter)) { setter.SetValue(_datasetsInstance, Activator.CreateInstance(setter.PropertyType)); } } PropertyInfo calcResultsSetter = _instance.GetType().GetProperty("CalcResultsCache"); if (calcResultsSetter != null) { Type propType = calcResultsSetter.PropertyType; object data = Activator.CreateInstance(propType); calcResultsSetter.SetValue(_instance, data); } IList <CalculationResult> calculationResults = new List <CalculationResult>(); Dictionary <string, string[]> results = (Dictionary <string, string[]>)_mainMethod.Invoke(_instance, null); foreach (KeyValuePair <string, string[]> calcResult in results) { if (calcResult.Value.Length < 1) { _logger.Error("The number of items returned from the key value pair in the calculation results is under the minimum required."); continue; } Tuple <FieldInfo, CalculationResult> func = _funcs.FirstOrDefault(m => string.Equals(m.Item2.Calculation.Id, calcResult.Key, StringComparison.InvariantCultureIgnoreCase)); if (func != null) { CalculationResult calculationResult = func.Item2; calculationResult.Value = calcResult.Value[0].GetValueOrNull <decimal>(); if (calcResult.Value.Length >= 3) { calculationResult.ExceptionType = calcResult.Value[1]; calculationResult.ExceptionMessage = calcResult.Value[2]; if (calcResult.Value.Count() == 4) { if (TimeSpan.TryParse(calcResult.Value[3], out TimeSpan ts)) { calculationResult.ElapsedTime = ts.Ticks; } } } calculationResults.Add(calculationResult); } } return(calculationResults); }
public async Task <IEnumerable <ProviderChangeItem> > AssembleProviderVariationItems(IEnumerable <ProviderResult> providerResults, IEnumerable <PublishedProviderResultExisting> existingPublishedProviderResults, string specificationId) { List <ProviderChangeItem> changeItems = new List <ProviderChangeItem>(); IEnumerable <ProviderSummary> coreProviderData = await _providerService.FetchCoreProviderData(); if (coreProviderData.IsNullOrEmpty()) { throw new NonRetriableException("Failed to retrieve core provider data"); } foreach (ProviderResult providerResult in providerResults) { PublishedProviderResultExisting existingResult = existingPublishedProviderResults.FirstOrDefault(r => r.ProviderId == providerResult.Provider.Id); // Ignore calculation results with no funding and no existing result if (existingResult == null && providerResult != null && providerResult.AllocationLineResults.All(r => !r.Value.HasValue)) { continue; } ProviderSummary coreProvider = coreProviderData.FirstOrDefault(p => p.Id == providerResult.Provider.Id); if (coreProvider == null) { throw new NonRetriableException($"Could not find provider in core data with id '{providerResult.Provider.Id}'"); } ProviderChangeItem changeItem = new ProviderChangeItem { UpdatedProvider = coreProvider }; if (existingResult != null) { if (existingResult.HasResultBeenVaried) { // Don't replay an already processed variation continue; } List <VariationReason> variationReasons = new List <VariationReason>(); if (coreProvider.Status == ProviderStatusClosed) { changeItem.HasProviderClosed = true; changeItem.ProviderReasonCode = coreProvider.ReasonEstablishmentClosed; changeItem.SuccessorProviderId = coreProvider.Successor; changeItem.DoesProviderHaveSuccessor = !string.IsNullOrWhiteSpace(coreProvider.Successor); } if (existingResult.Provider.Authority != coreProvider.Authority) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.AuthorityFieldUpdated); } if (existingResult.Provider.EstablishmentNumber != coreProvider.EstablishmentNumber) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.EstablishmentNumberFieldUpdated); } if (existingResult.Provider.DfeEstablishmentNumber != coreProvider.DfeEstablishmentNumber) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.DfeEstablishmentNumberFieldUpdated); } if (existingResult.Provider.Name != coreProvider.Name) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.NameFieldUpdated); } if (existingResult.Provider.LACode != coreProvider.LACode) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.LACodeFieldUpdated); } if (existingResult.Provider.LegalName != coreProvider.LegalName) { changeItem.HasProviderDataChanged = true; variationReasons.Add(VariationReason.LegalNameFieldUpdated); } if (coreProvider.Status != ProviderStatusClosed && !string.IsNullOrWhiteSpace(coreProvider.Successor)) { throw new NonRetriableException($"Provider has successor in core provider data but is not set to 'Closed' for provider '{providerResult.Provider.Id}'"); } if (!string.IsNullOrWhiteSpace(coreProvider.Successor)) { ProviderSummary successorCoreProvider = coreProviderData.FirstOrDefault(p => p.Id == coreProvider.Successor); if (successorCoreProvider == null) { throw new NonRetriableException($"Could not find provider successor in core provider data for provider '{providerResult.Provider.Id}' and successor '{coreProvider.Successor}'"); } changeItem.SuccessorProvider = successorCoreProvider; } changeItem.VariationReasons = variationReasons; changeItem.PriorProviderState = providerResult.Provider; } else { if (providerResult.AllocationLineResults.Any(r => r.Value.HasValue)) { changeItem.HasProviderOpened = true; changeItem.ProviderReasonCode = coreProvider.ReasonEstablishmentOpened; } } if (changeItem.HasProviderClosed || changeItem.HasProviderDataChanged || changeItem.HasProviderOpened) { if (!changeItems.Any(i => i.UpdatedProvider.Id == changeItem.UpdatedProvider.Id)) { changeItems.Add(changeItem); } } } return(changeItems); }
public void Execute_GivenAssembly_EnsuresBindingOfDataset() { //Arrange ILogger logger = CreateLogger(); IFeatureToggle featureToggle = CreateFeatureToggle(); Assembly assembly = CreateAssembly("CalculateFunding.Services.Calculator.Resources.implementation-test-with-datasets.dll"); AllocationModel allocationModel = new AllocationFactory(logger, featureToggle).CreateAllocationModel(assembly) as AllocationModel; IEnumerable <ProviderSourceDataset> sourceDatasets = CreateProviderSourceDatasets(); ProviderSummary providerSummary = CreateProviderSummary(); //Act IEnumerable <CalculationResult> calcResults = allocationModel.Execute(sourceDatasets.ToList(), providerSummary); //Assert calcResults.Any().Should().BeTrue(); dynamic instance = allocationModel.Instance as dynamic; Assert.IsNotNull(instance.Datasets); Assert.AreEqual(instance.Datasets.ABPE2109001.URN, "100000"); Assert.AreEqual(instance.Datasets.ABPE2109001.LocalAuthority, "201"); Assert.AreEqual(instance.Datasets.ABPE2109001.EstablishmentNumber, "3614"); Assert.AreEqual(instance.Datasets.ABPE2109001.LAEstab, "2013614"); Assert.AreEqual(instance.Datasets.ABPE2109001.SchoolType, "Voluntary aided school"); Assert.AreEqual(instance.Datasets.ABPE2109001.AcademyType, "Not Applicable"); Assert.AreEqual(instance.Datasets.ABPE2109001.PhaseOfEducation, "Primary"); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup1SoleRegistrations, 10); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup2SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup3SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup4SoleRegistrations, 11); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup5SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup6SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroupNotFollowedAge5To10SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup1SoleRegistrations, 59); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup2SoleRegistrations, 30); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup3SoleRegistrations, 31); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup4SoleRegistrations, 30); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup5SoleRegistrations, 30); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup6SoleRegistrations, 29); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroupNotFollowedAge5To10SoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup1DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup2DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup3DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup4DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup5DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroup6DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimeNumberOfPupilsInYearGroupNotFollowedAge5To10DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup1DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup2DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup3DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup4DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup5DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroup6DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimeNumberOfPupilsInYearGroupNotFollowedAge5To10DualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged5HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged6HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged6HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged8HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged9HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged10HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged5HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged6HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged7HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged8HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged9HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged10HospitalSchoolsSoleRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged5HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged6HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged7HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged8HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged9HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.PartTimePupilsAged10HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged5HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged6HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged7HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged8HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged9HosptialSchoolsDualRegistrations, 0); Assert.AreEqual(instance.Datasets.ABPE2109001.FullTimePupilsAged10HosptialSchoolsDualRegistrations, 0); }
public static OrganisationViewModel FromEnrichmentModel(UcasProviderEnrichmentGetModel ucasProviderEnrichmentGetModel, List <TrainingProviderViewModel> aboutAccreditingTrainingProviders, ProviderSummary providerSummary) { ucasProviderEnrichmentGetModel = ucasProviderEnrichmentGetModel ?? new UcasProviderEnrichmentGetModel { EnrichmentModel = new ProviderEnrichmentModel() { AccreditingProviderEnrichments = new List <AccreditingProviderEnrichment>() } }; var enrichmentModel = ucasProviderEnrichmentGetModel.EnrichmentModel; var result = new OrganisationViewModel { ProviderCode = providerSummary.ProviderCode, ProviderName = providerSummary.ProviderName, TrainWithUs = enrichmentModel.TrainWithUs, TrainWithDisability = enrichmentModel.TrainWithDisability, LastPublishedTimestampUtc = ucasProviderEnrichmentGetModel.LastPublishedTimestampUtc, Status = ucasProviderEnrichmentGetModel.Status, AboutTrainingProviders = aboutAccreditingTrainingProviders, Addr1 = enrichmentModel.Address1, Addr2 = enrichmentModel.Address2, Addr3 = enrichmentModel.Address3, Addr4 = enrichmentModel.Address4, Postcode = enrichmentModel.Postcode, Url = enrichmentModel.Website, Telephone = enrichmentModel.Telephone, EmailAddress = enrichmentModel.Email }; return(result); }
public ProviderResult CalculateProviderResults( IAllocationModel model, string specificationId, IEnumerable <CalculationSummaryModel> calculations, ProviderSummary provider, IDictionary <string, ProviderSourceDataset> providerSourceDatasets, IEnumerable <CalculationAggregation> aggregations = null) { var stopwatch = new Stopwatch(); stopwatch.Start(); CalculationResultContainer calculationResultContainer = model.Execute(providerSourceDatasets, provider, aggregations); IEnumerable <CalculationResult> calculationResultItems = calculationResultContainer.CalculationResults; stopwatch.Stop(); IDictionary <string, double> metrics = new Dictionary <string, double>() { { "calculation-provider-calcsMs", stopwatch.ElapsedMilliseconds }, { "calculation-provider-calcsTotal", calculations.AnyWithNullCheck() ? calculations.Count() : 0 }, { "calculation-provider-exceptions", calculationResultItems.AnyWithNullCheck() ? calculationResultItems.Count(c => !string.IsNullOrWhiteSpace(c.ExceptionMessage)) : 0 }, }; _telemetry.TrackEvent("CalculationRunProvider", new Dictionary <string, string>() { { "specificationId", specificationId }, }, metrics ); if (calculationResultItems.AnyWithNullCheck() && calculationResultItems.Count() > 0) { _logger.Verbose($"Processed results for {calculationResultItems.Count()} calcs in {stopwatch.ElapsedMilliseconds}ms ({stopwatch.ElapsedMilliseconds / calculationResultItems.Count(): 0.0000}ms)"); } else { _logger.Information("There are no calculations to executed for specification ID {specificationId}", specificationId); } byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes($"{provider.Id}-{specificationId}"); ProviderResult providerResult = new ProviderResult { Id = Convert.ToBase64String(plainTextBytes), Provider = provider, SpecificationId = specificationId }; if (calculationResultItems.AnyWithNullCheck()) { foreach (CalculationResult calcResult in calculationResultItems) { CalculationSummaryModel calculationSummaryModel = calculations.First(c => c.Id == calcResult.Calculation.Id); calcResult.CalculationType = calculationSummaryModel.CalculationType; calcResult.CalculationDataType = calculationSummaryModel.CalculationValueType.ToCalculationDataType(); if (calcResult.CalculationDataType == CalculationDataType.Decimal && Decimal.Equals(decimal.MinValue, calcResult.Value)) { // The default for the calculation is to return Decimal.MinValue - if this is the case, then subsitute a 0 value as the result, instead of the negative number. calcResult.Value = 0; } } } //we need a stable sort of results to enable the cache checks by overall SHA hash on the results json providerResult.CalculationResults = calculationResultContainer.CalculationResults?.OrderBy(_ => _.Calculation.Id).ToList(); providerResult.FundingLineResults = calculationResultContainer.FundingLineResults.OrderBy(_ => _.FundingLine.Id).ToList(); return(providerResult); }
/// <summary> /// Gets the provider summary report. /// </summary> /// <param name="gridSettings">The grid settings.</param> /// <param name="viewModel">The view model.</param> /// <returns></returns> public List <ProviderSummary> GetProviderSummaryReport(GridSettings gridSettings, SearchCriteriaViewModel viewModel) { var results = new List <ProviderSummary>(); using (var connection = new SqlConnection(DbConnection)) { using (var command = new SqlCommand("PaReportProviderSummary", connection)) { var sqlParams = new List <SqlParameter>(); var paramReturnValue = new SqlParameter("@return_value", SqlDbType.Int) { Direction = ParameterDirection.ReturnValue }; sqlParams.Add(paramReturnValue); SqlHelper.AddIntPara(gridSettings.PageIndex, "@pageIndex", sqlParams); SqlHelper.AddIntPara(gridSettings.PageSize, "@pageSize", sqlParams); SqlHelper.AddVarcharPara(viewModel.OrgCode, "@OrgCode", sqlParams); SqlHelper.AddVarcharPara(viewModel.ESACode, "@ESACode", sqlParams); SqlHelper.AddVarcharPara(viewModel.SiteCode, "@SiteCode", sqlParams); SqlHelper.AddVarcharPara(viewModel.ProjectID, "@ProjectID", sqlParams); SqlHelper.AddVarcharPara(viewModel.ProjectType, "@ProjectType", sqlParams); SqlHelper.AddVarcharPara(viewModel.ContractType, "@ContractType", sqlParams); SqlHelper.AddDatePara(viewModel.UploadDateFrom, "@UploadDateFrom", sqlParams); SqlHelper.AddDatePara(viewModel.UploadDateTo, "@UploadDateTo", sqlParams); SqlHelper.AddVarcharPara(viewModel.SortColumn, "@SortColumn", sqlParams); SqlHelper.AddVarcharPara(viewModel.SortBy, "@SortBy", sqlParams); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(sqlParams.ToArray()); connection.Open(); SqlDataReader reader = null; try { reader = command.ExecuteReader(); while (reader.Read()) { var record = new ProviderSummary { OrgCode = string.Format("{0}", reader["OrgCode"]), ESACode = string.Format("{0}", reader["ESACode"]), SiteCode = string.Format("{0}", reader["SiteCode"]), //State = reader["State"] as string, RecoveryCount = AppHelper.ToInt(reader["NoOfRecoveries"]), CompletedReviewCount = AppHelper.ToInt(reader["NoOfCompletedReviews"]), TotalReviewCount = AppHelper.ToInt(reader["TotalReviewsCount"]), ValidCount = AppHelper.ToInt(reader["NoOfReviewVAN"]), ValidAdminCount = AppHelper.ToInt(reader["NoOfReviewVAD"]), InvalidAdminCount = AppHelper.ToInt(reader["NoOfReviewIAD"]), InvalidRecovery = AppHelper.ToInt(reader["NoOfReviewINR"]), InvalidNoRecovery = AppHelper.ToInt(reader["NoOfReviewINN"]) }; results.Add(record); } } finally { if (reader != null) { reader.Close(); } } } } return(results); }
public async Task <IActionResult> ReIndex() { IEnumerable <DocumentEntity <TestScenarioResult> > testScenarioResults = await _testResultsRepository.GetAllTestResults(); IList <TestScenarioResultIndex> searchItems = new List <TestScenarioResultIndex>(); foreach (DocumentEntity <TestScenarioResult> documentEnity in testScenarioResults) { TestScenarioResult testScenarioResult = documentEnity.Content; ApiClientModels.ApiResponse <IEnumerable <ApiClientProviders.Models.ProviderSummary> > summariesApi = await _providersApiClient.FetchCoreProviderData(testScenarioResult.Specification.Id); if (summariesApi?.Content == null) { return(new NoContentResult()); } IEnumerable <ProviderSummary> summaries = _mapper.Map <IEnumerable <ProviderSummary> >(summariesApi); TestScenarioResultIndex testScenarioResultIndex = new TestScenarioResultIndex { TestResult = testScenarioResult.TestResult.ToString(), SpecificationId = testScenarioResult.Specification.Id, SpecificationName = testScenarioResult.Specification.Name, TestScenarioId = testScenarioResult.TestScenario.Id, TestScenarioName = testScenarioResult.TestScenario.Name, ProviderName = testScenarioResult.Provider.Name, ProviderId = testScenarioResult.Provider.Id, LastUpdatedDate = documentEnity.UpdatedAt }; ProviderSummary providerSummary = summaries.FirstOrDefault(m => m.Id == testScenarioResult.Provider.Id); if (providerSummary != null) { testScenarioResultIndex.EstablishmentNumber = providerSummary.EstablishmentNumber; testScenarioResultIndex.UKPRN = providerSummary.UKPRN; testScenarioResultIndex.UPIN = providerSummary.UPIN; testScenarioResultIndex.URN = providerSummary.URN; testScenarioResultIndex.LocalAuthority = providerSummary.Authority; testScenarioResultIndex.ProviderType = providerSummary.ProviderType; testScenarioResultIndex.ProviderSubType = providerSummary.ProviderSubType; testScenarioResultIndex.OpenDate = providerSummary.DateOpened; } searchItems.Add(testScenarioResultIndex); } for (int i = 0; i < searchItems.Count; i += 100) { IEnumerable <TestScenarioResultIndex> partitionedResults = searchItems.Skip(i).Take(100); IEnumerable <IndexError> errors = await _searchRepository.Index(partitionedResults); if (errors.Any()) { return(new InternalServerErrorResult(string.Empty)); } } return(new NoContentResult()); }
public void CalculateProviderResult_WhenCalculationsAreNotEmpty_ShouldReturnCorrectResult() { // Arrange List <Reference> policySpecificationsForFundingCalc = new List <Reference>() { new Reference("Spec1", "SpecOne"), new Reference("Spec2", "SpecTwo") }; Reference fundingCalcReference = new Reference("CalcF1", "Funding calc 1"); Reference numbercalcReference = new Reference("CalcF2", "Funding calc 2"); Reference booleancalcReference = new Reference("CalcF3", "Funding calc 3"); Reference fundingLineCalcReference = new Reference("FL1", "Funding line calc 1"); CalculationResult fundingCalcReturned = new CalculationResult() { Calculation = fundingCalcReference, Value = 10000 }; CalculationResult fundingCalcReturned2 = new CalculationResult() { Calculation = numbercalcReference, Value = 20000 }; CalculationResult fundingCalcReturned3 = new CalculationResult() { Calculation = booleancalcReference, Value = true }; CalculationResultContainer calculationResultContainer = new CalculationResultContainer(); List <CalculationResult> calculationResults = new List <CalculationResult>() { fundingCalcReturned, fundingCalcReturned2, fundingCalcReturned3 }; calculationResultContainer.CalculationResults = calculationResults; string fundingStreamId = "FS1"; FundingLineResult fundingLineResult = new FundingLineResult { Value = 1000, FundingLine = fundingLineCalcReference, FundingLineFundingStreamId = fundingStreamId }; List <FundingLineResult> fundingLineResults = new List <FundingLineResult> { fundingLineResult }; calculationResultContainer.FundingLineResults = fundingLineResults; IAllocationModel mockAllocationModel = Substitute.For <IAllocationModel>(); mockAllocationModel .Execute(Arg.Any <Dictionary <string, ProviderSourceDataset> >(), Arg.Any <ProviderSummary>()) .Returns(calculationResultContainer); CalculationEngine calculationEngine = CreateCalculationEngine(); ProviderSummary providerSummary = CreateDummyProviderSummary(); BuildProject buildProject = CreateBuildProject(); var nonMatchingCalculationModel = new CalculationSummaryModel() { Id = "Non matching calculation", Name = "Non matching calculation", CalculationType = CalculationType.Template, CalculationValueType = CalculationValueType.Number }; IEnumerable <CalculationSummaryModel> calculationSummaryModels = new[] { new CalculationSummaryModel() { Id = fundingCalcReference.Id, Name = fundingCalcReference.Name, CalculationType = CalculationType.Template, CalculationValueType = CalculationValueType.Number }, new CalculationSummaryModel() { Id = numbercalcReference.Id, Name = numbercalcReference.Name, CalculationType = CalculationType.Template, CalculationValueType = CalculationValueType.Number }, new CalculationSummaryModel() { Id = booleancalcReference.Id, Name = booleancalcReference.Name, CalculationType = CalculationType.Template, CalculationValueType = CalculationValueType.Boolean }, nonMatchingCalculationModel }; // Act var calculateProviderResults = calculationEngine.CalculateProviderResults(mockAllocationModel, buildProject.SpecificationId, calculationSummaryModels, providerSummary, new Dictionary <string, ProviderSourceDataset>()); ProviderResult result = calculateProviderResults; // Assert result.Provider.Should().Be(providerSummary); result.SpecificationId.Should().BeEquivalentTo(buildProject.SpecificationId); result.Id.Should().BeEquivalentTo(GenerateId(providerSummary.Id, buildProject.SpecificationId)); result.CalculationResults.Should().HaveCount(3); result.FundingLineResults.Should().HaveCount(1); CalculationResult fundingCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == fundingCalcReference.Id); fundingCalcResult.Calculation.Should().BeEquivalentTo(fundingCalcReference); fundingCalcResult.CalculationType.Should().BeEquivalentTo(CalculationType.Template); fundingCalcResult.Value.Should().Be(fundingCalcReturned.Value); fundingCalcResult.CalculationDataType.Should().Be(CalculationDataType.Decimal); CalculationResult numberCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == numbercalcReference.Id); numberCalcResult.Calculation.Should().BeEquivalentTo(numbercalcReference); numberCalcResult.CalculationType.Should().BeEquivalentTo(CalculationType.Template); numberCalcResult.Value.Should().Be(fundingCalcReturned2.Value); numberCalcResult.CalculationDataType.Should().Be(CalculationDataType.Decimal); CalculationResult booleanCalcResult = result.CalculationResults.First(cr => cr.Calculation.Id == booleancalcReference.Id); booleanCalcResult.Calculation.Should().BeEquivalentTo(booleancalcReference); booleanCalcResult.CalculationType.Should().BeEquivalentTo(CalculationType.Template); booleanCalcResult.Value.Should().Be(fundingCalcReturned3.Value); booleanCalcResult.CalculationDataType.Should().Be(CalculationDataType.Boolean); FundingLineResult fundingLineCalcResult = result.FundingLineResults.First(cr => cr.FundingLine.Id == fundingLineCalcReference.Id); fundingLineCalcResult.FundingLine.Should().BeEquivalentTo(fundingLineCalcReference); fundingLineCalcResult.Value.Should().Be(fundingLineResult.Value); fundingLineCalcResult.FundingLineFundingStreamId.Should().Be(fundingStreamId); }
private CourseViewModel LoadViewModel(ProviderSummary org, Domain.Models.Course course, bool multipleOrganisations, UcasCourseEnrichmentGetModel ucasCourseEnrichmentGetModel, CourseRouteDataViewModel routeData) { var courseVariant = new ViewModels.CourseDetailsViewModel { CourseTitle = course.Name, Type = course.TypeDescription, AccreditingProviderName = course.AccreditingProvider?.ProviderName, AccreditingProviderCode = course.AccreditingProvider?.ProviderCode, CourseCode = course.CourseCode, ProviderCode = course.Provider.ProviderCode, AgeRange = course.AgeRange, Route = course.ProgramType, Qualifications = course.ProfpostFlag, StudyMode = course.StudyMode, Subjects = course.Subjects, Status = course.GetCourseStatus(), Sites = course.CourseSites.Select(courseSite => { var addressLines = (new List <string>() { courseSite.Site.Address1, courseSite.Site.Address2, courseSite.Site.Address3, courseSite.Site.Address4, courseSite.Site.Postcode }) .Where(line => !string.IsNullOrEmpty(line)); var address = addressLines.Count() > 0 ? addressLines.Where(line => !string.IsNullOrEmpty(line)) .Aggregate((string current, string next) => current + ", " + next) : ""; return(new SiteViewModel { ApplicationsAcceptedFrom = courseSite.ApplicationsAcceptedFrom.ToString(), Code = courseSite.Site.Code, LocationName = courseSite.Site.LocationName, Address = address, Status = courseSite.Status, VacStatus = courseSite.VacStatus }); }) }; var isSalary = course.ProgramType.Equals("SS", StringComparison.InvariantCultureIgnoreCase) || course.ProgramType.Equals("TA", StringComparison.InvariantCultureIgnoreCase); var courseEnrichmentViewModel = GetCourseEnrichmentViewModel(ucasCourseEnrichmentGetModel, isSalary, routeData); var viewModel = new CourseViewModel { ProviderName = org.ProviderName, ProviderCode = org.ProviderCode, CourseTitle = course.Name, AccreditingProviderCode = course.AccreditingProvider?.ProviderCode, MultipleOrganisations = multipleOrganisations, Course = courseVariant, CourseEnrichment = courseEnrichmentViewModel, LiveSearchUrl = searchAndCompareUrlService.GetCoursePageUri(org.ProviderCode, courseVariant.CourseCode), IsSalary = isSalary }; return(viewModel); }
public IEnumerable <ExpandoObject> TransformProviderResultsIntoCsvRows(IEnumerable <ProviderResult> providerResults, IDictionary <string, TemplateMappingItem> allTemplateMappings) { int resultsCount = providerResults.Count(); ExpandoObject[] resultsBatch = _expandoObjectsPool.Rent(resultsCount); for (int resultCount = 0; resultCount < resultsCount; resultCount++) { ProviderResult result = providerResults.ElementAt(resultCount); IDictionary <string, object> row = resultsBatch[resultCount] ?? (resultsBatch[resultCount] = new ExpandoObject()); ProviderSummary providerSummary = result.Provider; row["UKPRN"] = providerSummary.UKPRN; row["URN"] = providerSummary.URN; row["Estab Number"] = providerSummary.EstablishmentNumber; row["Provider Name"] = providerSummary.Name; row["LA Code"] = providerSummary.LACode; row["LA Name"] = providerSummary.Authority; row["Provider Type"] = providerSummary.ProviderType; row["Provider SubType"] = providerSummary.ProviderSubType; if (result.FundingLineResults != null) { foreach (FundingLineResult fundingLineResult in result.FundingLineResults) { row[$"FUN: {fundingLineResult.FundingLine.Name} ({fundingLineResult.FundingLine.Id})"] = fundingLineResult.Value?.ToString(); } } //all of the provider results inside a single specification id will share the same //lists of template calculations so we don't really need to handle missing calc results //from provider result to provider result foreach (CalculationResult templateCalculationResult in result.CalculationResults.Where(_ => _.Calculation != null && _.CalculationType == CalculationType.Template) .OrderBy(_ => _.Calculation.Name)) { if (allTemplateMappings.ContainsKey(templateCalculationResult.Calculation.Id)) { row[$"CAL: {templateCalculationResult.Calculation.Name} ({allTemplateMappings[templateCalculationResult.Calculation.Id].TemplateId})"] = templateCalculationResult.Value?.ToString(); } else { // this calc has changed from a template calculation to an additional calculation so it won't be part of the template calculations collection row[$"ADD: {templateCalculationResult.Calculation.Name}"] = templateCalculationResult.Value?.ToString(); } } foreach (CalculationResult templateCalculationResult in result.CalculationResults.Where(_ => _.Calculation != null && _.CalculationType == CalculationType.Additional) .OrderBy(_ => _.Calculation.Name)) { row[$"ADD: {templateCalculationResult.Calculation.Name}"] = templateCalculationResult.Value?.ToString(); } yield return((ExpandoObject)row); } _expandoObjectsPool.Return(resultsBatch); }
public async Task <IActionResult> PreviewCalculationResult( string specificationId, string providerId, PreviewCalculationRequest previewCalculationRequest) { Guard.IsNullOrWhiteSpace(specificationId, nameof(specificationId)); Guard.IsNullOrWhiteSpace(providerId, nameof(providerId)); Guard.ArgumentNotNull(previewCalculationRequest, nameof(previewCalculationRequest)); Assembly assembly = Assembly.Load(previewCalculationRequest.AssemblyContent); IAllocationModel allocationModel = _calculationEngine.GenerateAllocationModel(assembly); SpecificationSummary specificationSummary = await GetSpecificationSummary(specificationId); ApiResponse <ProviderVersionSearchResult> providerVersionSearchResultApiResponse = await _providersApiClientPolicy.ExecuteAsync(() => _providersApiClient.GetProviderByIdFromProviderVersion( specificationSummary.ProviderVersionId, providerId)); ProviderVersionSearchResult providerVersionSearchResult = providerVersionSearchResultApiResponse.Content; if (providerVersionSearchResult == null) { return(new NotFoundResult()); } ProviderSummary providerSummary = _mapper.Map <ProviderSummary>(providerVersionSearchResult); List <CalculationSummaryModel> calculationSummaries = new List <CalculationSummaryModel>(); IEnumerable <CalculationSummaryModel> specCalculationSummaries = await GetCalculationSummaries(specificationId); calculationSummaries.AddRange(specCalculationSummaries); calculationSummaries.Add(previewCalculationRequest.PreviewCalculationSummaryModel); Dictionary <string, Dictionary <string, ProviderSourceDataset> > providerSourceDatasets = await _providerSourceDatasetsRepository.GetProviderSourceDatasetsByProviderIdsAndRelationshipIds( specificationId, new[] { providerId }, specificationSummary.DataDefinitionRelationshipIds); Dictionary <string, ProviderSourceDataset> providerSourceDataset = providerSourceDatasets[providerId]; BuildAggregationRequest buildAggregationRequest = new BuildAggregationRequest { SpecificationId = specificationId, GenerateCalculationAggregationsOnly = true, BatchCount = 100 }; IEnumerable <CalculationAggregation> calculationAggregations = await _calculationAggregationService.BuildAggregations(buildAggregationRequest); ProviderResult providerResult = _calculationEngine.CalculateProviderResults( allocationModel, specificationId, calculationSummaries, providerSummary, providerSourceDataset, calculationAggregations ); return(new OkObjectResult(providerResult)); }
public ProviderResultBuilder WithProviderSummary(ProviderSummary providerSummary) { _providerSummary = providerSummary; return(this); }