public IActionResult SignpostingParametersSetTriggerValuesNext(CompetencyResourceAssessmentQuestionParameter assessmentParameter, int[] selectedLevelValues, int frameworkId, int frameworkCompetencyId, int frameworkCompetencyGroupId) { var session = multiPageFormService.GetMultiPageFormData <SessionCompetencyLearningResourceSignpostingParameter>( MultiPageFormDataFeature.EditSignpostingParameter, TempData ); var updateSelectedValuesFromSlider = session.SelectedQuestion.AssessmentQuestionInputTypeID == 2; bool skipCompare = session.Questions.Count() < 2 && session.SelectedQuestionRoleRequirements == 0; session.AssessmentQuestionParameter.MinResultMatch = updateSelectedValuesFromSlider ? assessmentParameter.MinResultMatch : selectedLevelValues.DefaultIfEmpty(0).Min(); session.AssessmentQuestionParameter.MaxResultMatch = updateSelectedValuesFromSlider ? assessmentParameter.MaxResultMatch : selectedLevelValues.DefaultIfEmpty(0).Max(); session.TriggerValuesConfirmed = true; multiPageFormService.SetMultiPageFormData( session, MultiPageFormDataFeature.EditSignpostingParameter, TempData ); if (skipCompare) { session.CompareQuestionConfirmed = false; multiPageFormService.SetMultiPageFormData( session, MultiPageFormDataFeature.EditSignpostingParameter, TempData ); return(RedirectToAction("SignpostingSetStatus", new { frameworkId, frameworkCompetencyId, frameworkCompetencyGroupId })); } else { return(RedirectToAction("CompareSelfAssessmentResult", new { frameworkId, frameworkCompetencyId, frameworkCompetencyGroupId })); } }
public void GetCompetencyResourceAssessmentQuestionParameters_returns_expected_results() { using (new TransactionScope()) { var adminId = UserTestHelper.GetDefaultAdminUser().Id; testHelper.InsertLearningResourceReference(2, 2, adminId, "Resource 2"); testHelper.InsertCompetencyLearningResource(1, 1, 2, adminId); testHelper.InsertCompetencyResourceAssessmentQuestionParameters(1, 1, true, 2, false, 1, 10); var expectedItem = new CompetencyResourceAssessmentQuestionParameter { CompetencyLearningResourceId = 1, AssessmentQuestionId = 1, Essential = true, RelevanceAssessmentQuestionId = 2, CompareToRoleRequirements = false, MinResultMatch = 1, MaxResultMatch = 10, }; // When var result = service.GetCompetencyResourceAssessmentQuestionParameters(new[] { 1 }).ToList(); // Then result.Should().HaveCount(1); result.Should().ContainEquivalentOf(expectedItem); } }
private decimal CalculateRelConValue( int competencyId, int selfAssessmentId, int delegateId, CompetencyResourceAssessmentQuestionParameter competencyResourceAssessmentQuestionParameter ) { var delegateResults = selfAssessmentDataService .GetSelfAssessmentResultsForDelegateSelfAssessmentCompetency( delegateId, selfAssessmentId, competencyId ).ToList(); var latestConfidenceResult = delegateResults .Where( dr => dr.AssessmentQuestionId == competencyResourceAssessmentQuestionParameter.AssessmentQuestionId ) .OrderByDescending(dr => dr.DateTime).FirstOrDefault(); var latestRelevanceResult = delegateResults .Where( dr => dr.AssessmentQuestionId == competencyResourceAssessmentQuestionParameter.RelevanceAssessmentQuestionId ) .OrderByDescending(dr => dr.DateTime).FirstOrDefault(); if (latestConfidenceResult != null && latestRelevanceResult != null) { return((latestRelevanceResult.Result - latestConfidenceResult.Result) * 10); } return(0); }
public SessionCompetencyLearningResourceSignpostingParameter(FrameworkCompetency frameworkCompetency, string resourceName, List <AssessmentQuestion> questions, AssessmentQuestion selectedQuestion, CompareAssessmentQuestionType selectedCompareQuestionType, CompetencyResourceAssessmentQuestionParameter assessmentQuestionParameter) { FrameworkCompetency = frameworkCompetency; ResourceName = resourceName; Questions = questions; AssessmentQuestionParameter = assessmentQuestionParameter; SelectedQuestion = selectedQuestion; SelectedCompareQuestionType = selectedCompareQuestionType; TriggerValuesConfirmed = false; CompareQuestionConfirmed = false; }