/// <summary> /// Scores the test. /// </summary> /// <param name="selectedResponseIDs">a List of ResponseIDs to be scored.</param> /// <returns>a struct TestResults object with final scores.</returns> static public AssessmentResults Score(List <string> selectedResponseIDs) { List <DiscService.ResponseItem> responseList = DiscService.GetResponses(); // Holds the most and least totals for each Letter attribute Dictionary <string, int[]> results = new Dictionary <string, int[]>(); results["S"] = new int[] { 0, 0 }; results["C"] = new int[] { 0, 0 }; results["I"] = new int[] { 0, 0 }; results["N"] = new int[] { 0, 0 }; // This is intentionally not used after most/least totalling (foreach loop below). Placebo questions? results["D"] = new int[] { 0, 0 }; foreach (string selectedResponseID in selectedResponseIDs) { string responseID = selectedResponseID.Substring(0, 3); string MorL = selectedResponseID.Substring(3, 1); DiscService.ResponseItem selectedResponse = responseList.Find( delegate(DiscService.ResponseItem responseItem) { return(responseItem.ResponseID == responseID); } ); if (MorL == "m") { results[selectedResponse.MostScore][0]++; } else { results[selectedResponse.LeastScore][1]++; } } int nbS = 27 - results["S"][1]; int nbC = 26 - results["C"][1]; int nbI = 26 - results["I"][1]; int nbD = 27 - results["D"][1]; decimal decX = results["S"][0] + results["C"][0] + results["I"][0] + results["D"][0]; decimal decY = nbS + nbC + nbI + nbD; AssessmentResults testResults = new AssessmentResults(); if (decX > 0 && decY > 0) { testResults.AdaptiveBehaviorS = Convert.ToInt32((results["S"][0] / decX * 100)); testResults.AdaptiveBehaviorC = Convert.ToInt32((results["C"][0] / decX * 100)); testResults.AdaptiveBehaviorI = Convert.ToInt32((results["I"][0] / decX * 100)); testResults.AdaptiveBehaviorD = Convert.ToInt32((results["D"][0] / decX * 100)); testResults.NaturalBehaviorS = Convert.ToInt32((nbS / decY * 100)); testResults.NaturalBehaviorC = Convert.ToInt32((nbC / decY * 100)); testResults.NaturalBehaviorI = Convert.ToInt32((nbI / decY * 100)); testResults.NaturalBehaviorD = Convert.ToInt32((nbD / decY * 100)); } return(testResults); }
/// <summary> /// Shows the results of the assessment test. /// </summary> /// <param name="savedScores">The saved scores.</param> private void ShowResults(DiscService.AssessmentResults savedScores) { // Plot the Natural graph DiscService.PlotOneGraph(discNaturalScore_D, discNaturalScore_I, discNaturalScore_S, discNaturalScore_C, savedScores.NaturalBehaviorD, savedScores.NaturalBehaviorI, savedScores.NaturalBehaviorS, savedScores.NaturalBehaviorC, 35); ShowExplaination(savedScores.PersonalityType); }
/// <summary> /// Shows the results of the assessment test. /// </summary> /// <param name="savedScores">The saved scores.</param> private void ShowResults( DiscService.AssessmentResults savedScores ) { // Plot the Natural graph DiscService.PlotOneGraph( discNaturalScore_D, discNaturalScore_I, discNaturalScore_S, discNaturalScore_C, savedScores.NaturalBehaviorD, savedScores.NaturalBehaviorI, savedScores.NaturalBehaviorS, savedScores.NaturalBehaviorC, 35 ); ShowExplaination( savedScores.PersonalityType ); hlAssessmentDate.Text = String.Format( "Assessment Date: {0}", savedScores.LastSaveDate.ToShortDateString() ); lPersonName.Text = _targetPerson.FullName; lHeading.Text = string.Format( "<div class='disc-heading'><h1>{0}</h1><h4>Personality Type: {1}</h4></div>", _targetPerson.FullName, savedScores.PersonalityType ); }
/// <summary> /// Shows the results of the assessment test. /// </summary> /// <param name="savedScores">The saved scores.</param> private void ShowResults( DiscService.AssessmentResults savedScores ) { pnlInstructions.Visible = false; pnlQuestions.Visible = false; pnlResults.Visible = true; if ( CurrentPersonId == _targetPerson.Id ) { lPrintTip.Visible = true; } lHeading.Text = string.Format( "<div class='disc-heading'><h1>{0}</h1><h4>Personality Type: {1}</h4></div>", _targetPerson.FullName, savedScores.PersonalityType ); // Show re-take test button if MinDaysToRetake has passed... double days = GetAttributeValue( "MinDaysToRetake" ).AsDouble(); if ( (savedScores.LastSaveDate.AddDays( days ) <= RockDateTime.Now) || GetAttributeValue( "AlwaysAllowRetakes" ).AsBoolean() ) { btnRetakeTest.Visible = true; } PlotGraph( savedScores ); ShowExplaination( savedScores.PersonalityType ); }
/// <summary> /// Plots the graphs using the Disc score results. /// </summary> /// <param name="results">The results.</param> private void PlotGraph( DiscService.AssessmentResults results ) { // Plot the Natural graph DiscService.PlotOneGraph( discNaturalScore_D, discNaturalScore_I, discNaturalScore_S, discNaturalScore_C, results.NaturalBehaviorD, results.NaturalBehaviorI, results.NaturalBehaviorS, results.NaturalBehaviorC, 35 ); }
/// <summary> /// Inserts a TableRow into the Question Table. /// </summary> /// <param name="response">The question response to add.</param> private void buildRadioButtonTableRow(DiscService.ResponseItem response) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); tc.Text = response.ResponseText; tr.Cells.Add(tc); tc = new TableCell(); RadioButton rb = createRadioButton(response.QuestionNumber, response.ResponseNumber, "m"); tc.Controls.Add(rb); tr.Cells.Add(tc); tc = new TableCell(); rb = createRadioButton(response.QuestionNumber, response.ResponseNumber, "l"); tc.Controls.Add(rb); tr.Cells.Add(tc); tblQuestions.Rows.Add(tr); }
/// <summary> /// Shows the results of the assessment test. /// </summary> /// <param name="savedScores">The saved scores.</param> private void ShowResults( DiscService.AssessmentResults savedScores ) { // NewPointe alteration: redirect to SHAPE profile page instead string shapeRedirectUrl = "https://newpointe.org/ShapeProfile?PersonId=" + _targetPerson.Id; Response.Redirect(shapeRedirectUrl, true); // end NewPointe alteration: pnlInstructions.Visible = false; pnlQuestions.Visible = false; pnlResults.Visible = true; if ( CurrentPersonId == _targetPerson.Id ) { lPrintTip.Visible = true; } lHeading.Text = string.Format( "<div class='disc-heading'><h1>{0}</h1><h4>Personality Type: {1}</h4></div>", _targetPerson.FullName, savedScores.PersonalityType ); // Show re-take test button if MinDaysToRetake has passed... double days = GetAttributeValue( "MinDaysToRetake" ).AsDouble(); if ( (savedScores.LastSaveDate.AddDays( days ) <= RockDateTime.Now) || GetAttributeValue( "AlwaysAllowRetakes" ).AsBoolean() ) { btnRetakeTest.Visible = true; } PlotGraph( savedScores ); ShowExplaination( savedScores.PersonalityType ); }