Exemplo n.º 1
0
        public async Task WhenAsync(long aoUkprn, long uln, bool isActiveAssessment)
        {
            if (_result != null)
            {
                return;
            }

            TqPathwayAssessment pathwayAssessment = null;

            if (isActiveAssessment)
            {
                pathwayAssessment = _pathwayAssessments.FirstOrDefault(pa => pa.IsOptedin && pa.EndDate == null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln);
            }
            else
            {
                pathwayAssessment = _pathwayAssessments.FirstOrDefault(pa => !pa.IsOptedin && pa.EndDate != null && pa.TqRegistrationPathway.TqRegistrationProfile.UniqueLearnerNumber == uln);
            }

            var assessmentId = pathwayAssessment != null ? pathwayAssessment.Id : 0;

            _result = await AssessmentService.GetActivePathwayAssessmentEntryDetailsAsync(aoUkprn, assessmentId);
        }