public bool ConditionMet(int standardCode, int?totalPMRValue, IReadOnlyCollection <ILearningDelivery> learningDeliveries) { if (!totalPMRValue.HasValue) { return(false); } var standardLearningDeliveries = learningDeliveries.Where(x => x.StdCodeNullable == standardCode).ToList(); if (!_dd17.IsTotalNegotiatedPriceMoreThanCapForStandard(standardLearningDeliveries, standardCode)) { var standardTNPTotal = _learningDeliveryAppFinRecordQueryService.GetTotalTNPPriceForLatestAppFinRecordsForLearning(standardLearningDeliveries); return(totalPMRValue > Math.Round((1m / 3m) * standardTNPTotal)); } return(false); }
public bool ConditionMet(int standardCode, int?totalPMRValue, IReadOnlyCollection <ILearningDelivery> learningDeliveries) { if (!totalPMRValue.HasValue) { return(false); } var standardLearningDeliveries = learningDeliveries.Where(x => x.StdCodeNullable == standardCode).ToList(); if (_dd17.IsTotalNegotiatedPriceMoreThanCapForStandard(standardLearningDeliveries, standardCode)) { var standardTNPTotal = _learningDeliveryAppFinRecordQueryService.GetTotalTNPPriceForLatestAppFinRecordsForLearning(standardLearningDeliveries); var applicableDateForCap = GetApplicableDateForCapChecking(standardLearningDeliveries); var fundingCap = _larsDataService.GetStandardFundingForCodeOnDate(standardCode, applicableDateForCap)?.CoreGovContributionCap; return(fundingCap.HasValue && totalPMRValue > (standardTNPTotal - fundingCap)); } return(false); }