public string AttemptDistributionData(int selectedAssessment = 0, string scorebandNameForPass = "******") { var accountModel = AuthHelper.GetAccountModel(Request); var results = ResultsDAL.GetResultsForAssessment(accountModel, selectedAssessment).ToList(); var firstPassedResults = GetFirstPassedResults(scorebandNameForPass, results); var totalAttempts = firstPassedResults.Count; var meanAttempts = GetRoundedMeanAttempts(firstPassedResults); var standardDeviationAttempts = GetRoundedStandardDeviationAttempts(firstPassedResults, meanAttempts); var medianAttempts = GetRoundedMedianAttempts(firstPassedResults); var highestResultCount = GetHighestResultCount(firstPassedResults); var chartData = GetAttemptDistributionChartData(firstPassedResults); var meanAttemptsAsString = !double.IsNaN(meanAttempts) ? string.Format("{0:F1}", meanAttempts) : "-"; var standardDeviationAttemptsAsString = !double.IsNaN(standardDeviationAttempts) ? string.Format("{0:F1}", standardDeviationAttempts) : "-"; var medianAttemptsAsString = !double.IsNaN(medianAttempts) ? string.Format("{0:F1}", medianAttempts) : "-"; var jsonData = string.Format(@" {{ ""totalAttempts"":[{0}], ""meanAttempts"":[""{1}""], ""standardDeviationAttempts"":[""{2}""], ""medianAttempts"":[""{3}""], ""highestResultCount"":[{4}], ""chartData"":[{5}] }}", totalAttempts, meanAttemptsAsString, standardDeviationAttemptsAsString, medianAttemptsAsString, highestResultCount, chartData); return(jsonData); }
public string ScoreCorrelationData(int firstSelectedAssessment = 0, int secondSelectedAssessment = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var resultsForFirstAssessment = ResultsDAL.GetResultsForAssessment(accountModel, firstSelectedAssessment).ToList(); var resultsForSecondAssessment = ResultsDAL.GetResultsForAssessment(accountModel, secondSelectedAssessment).ToList(); // only look at the first attempts for each result to ensure a valid comparison var resultsForFirstAssessmentFirstAttempt = GetOnlyFirstAttempts(resultsForFirstAssessment); var resultsForSecondAssessmentFirstAttempt = GetOnlyFirstAttempts(resultsForSecondAssessment); var chartData = GetScoreCorrelationChartData(resultsForFirstAssessmentFirstAttempt, resultsForSecondAssessmentFirstAttempt); var jsonData = string.Format(@" {{ ""chartData"":[{0}] }}", chartData); return(jsonData); }
public string ScoreDistributionData(int selectedAssessment = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var results = ResultsDAL.GetResultsForAssessment(accountModel, selectedAssessment).ToList(); var highestResultCount = GetHighestResultCountGroupedByPercentile(results); var numberOfResults = results.Count; var meanPercentageScore = GetRoundedMeanPercentageScore(results); var standardDeviation = GetRoundedStandardDeviation(results, meanPercentageScore); var chartData = GetScoreDistributionChartData(results); var meanPercentageScoreAsString = !double.IsNaN(meanPercentageScore) ? string.Format("{0}%", meanPercentageScore) : "-"; var standardDeviationAsString = !double.IsNaN(standardDeviation) ? string.Format("{0}%", standardDeviation) : "-"; var jsonData = string.Format(@" {{ ""highestResultCount"":{0}, ""numberOfResults"":{1}, ""meanPercentageScore"":""{2}"", ""standardDeviation"":""{3}"", ""chartData"":[{4}] }}", highestResultCount, numberOfResults, meanPercentageScoreAsString, standardDeviationAsString, chartData); return(jsonData); }
public string PreTestPostTestData( int firstAssessment = 0, Attempt firstAssessmentAttemptToUse = Attempt.First, int firstAssessmentAttemptNumber = 0, int secondAssessment = 0, Attempt secondAssessmentAttemptToUse = Attempt.First, int secondAssessmentAttemptNumber = 0) { var accountModel = AuthHelper.GetAccountModel(Request); var resultsForFirstAssessment = ResultsDAL.GetResultsForAssessment(accountModel, firstAssessment).ToList(); var resultsForSecondAssessment = ResultsDAL.GetResultsForAssessment(accountModel, secondAssessment).ToList(); var singleAttemptResultsForFirstAssessment = FilterResultsForAttemptNumber(resultsForFirstAssessment, firstAssessmentAttemptToUse, firstAssessmentAttemptNumber); var singleAttemptResultsForSecondAssessment = FilterResultsForAttemptNumber(resultsForSecondAssessment, secondAssessmentAttemptToUse, secondAssessmentAttemptNumber); var filteredResultsForFirstAssessment = FilterResultsMissingFromOtherAssessment(singleAttemptResultsForFirstAssessment, singleAttemptResultsForSecondAssessment); var filteredResultsForSecondAssessment = FilterResultsMissingFromOtherAssessment(singleAttemptResultsForSecondAssessment, singleAttemptResultsForFirstAssessment); var countOfFilteredResultsForFirstAssessment = filteredResultsForFirstAssessment.Count; var countOfIgnoredResultsForFirstAssessment = singleAttemptResultsForFirstAssessment.Count - filteredResultsForFirstAssessment.Count; var meanScoreOfFilteredResultsForFirstAssessment = GetRoundedMeanPercentageScore(filteredResultsForFirstAssessment); var standardDeviationOfFilteredResultsForFirstAssessment = GetRoundedStandardDeviation(filteredResultsForFirstAssessment, meanScoreOfFilteredResultsForFirstAssessment); var medianScoreOfFilteredResultsForFirstAssessment = GetRoundedMedianPercentageScore(filteredResultsForFirstAssessment); var meanScoreOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(meanScoreOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", meanScoreOfFilteredResultsForFirstAssessment) : "-"; var standardDeviationOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(standardDeviationOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", standardDeviationOfFilteredResultsForFirstAssessment) : "-"; var medianScoreOfFilteredResultsForFirstAssessmentAsString = !double.IsNaN(medianScoreOfFilteredResultsForFirstAssessment) ? string.Format("{0:F1}%", medianScoreOfFilteredResultsForFirstAssessment) : "-"; var countOfFilteredResultsForSecondAssessment = filteredResultsForSecondAssessment.Count; var countOfIgnoredResultsForSecondAssessment = singleAttemptResultsForSecondAssessment.Count - filteredResultsForSecondAssessment.Count; var meanScoreOfFilteredResultsForSecondAssessment = GetRoundedMeanPercentageScore(filteredResultsForSecondAssessment); var standardDeviationOfFilteredResultsForSecondAssessment = GetRoundedStandardDeviation(filteredResultsForSecondAssessment, meanScoreOfFilteredResultsForSecondAssessment); var medianScoreOfFilteredResultsForSecondAssessment = GetRoundedMedianPercentageScore(filteredResultsForSecondAssessment); var meanScoreOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(meanScoreOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", meanScoreOfFilteredResultsForSecondAssessment) : "-"; var standardDeviationOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(standardDeviationOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", standardDeviationOfFilteredResultsForSecondAssessment) : "-"; var medianScoreOfFilteredResultsForSecondAssessmentAsString = !double.IsNaN(medianScoreOfFilteredResultsForSecondAssessment) ? string.Format("{0:F1}%", medianScoreOfFilteredResultsForSecondAssessment) : "-"; var quartileScoresForFirstAssessment = GetQuartileScores(filteredResultsForFirstAssessment); var quartileScoresForSecondAssessment = GetQuartileScores(filteredResultsForSecondAssessment); var q0ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile0Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile0Score) : "-"; var q1ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile1Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile1Score) : "-"; var q2ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile2Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile2Score) : "-"; var q3ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile3Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile3Score) : "-"; var q4ScoreForFirstAssessmentAsString = !double.IsNaN(quartileScoresForFirstAssessment.Quartile4Score) ? string.Format("{0:F1}%", quartileScoresForFirstAssessment.Quartile4Score) : "-"; var q0ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile0Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile0Score) : "-"; var q1ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile1Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile1Score) : "-"; var q2ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile2Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile2Score) : "-"; var q3ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile3Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile3Score) : "-"; var q4ScoreForSecondAssessmentAsString = !double.IsNaN(quartileScoresForSecondAssessment.Quartile4Score) ? string.Format("{0:F1}%", quartileScoresForSecondAssessment.Quartile4Score) : "-"; var nameForFirstAssessment = resultsForFirstAssessment.Count > 0 ? resultsForFirstAssessment[0].AssessmentName : "-"; var nameForSecondAssessment = resultsForSecondAssessment.Count > 0 ? resultsForSecondAssessment[0].AssessmentName : "-"; var chartData = GetPreTestPostTestChartData(nameForFirstAssessment, quartileScoresForFirstAssessment, nameForSecondAssessment, quartileScoresForSecondAssessment); var jsonData = string.Format(@" {{ ""countOfFilteredResultsForFirstAssessment"":{0}, ""countOfIgnoredResultsForFirstAssessment"":{1}, ""meanScoreOfFilteredResultsForFirstAssessment"":""{2}"", ""standardDeviationOfFilteredResultsForFirstAssessment"":""{3}"", ""medianScoreOfFilteredResultsForFirstAssessment"":""{4}"", ""quartile0ScoreForFirstAssessment"":""{5}"", ""quartile1ScoreForFirstAssessment"":""{6}"", ""quartile2ScoreForFirstAssessment"":""{7}"", ""quartile3ScoreForFirstAssessment"":""{8}"", ""quartile4ScoreForFirstAssessment"":""{9}"", ""countOfFilteredResultsForSecondAssessment"":{10}, ""countOfIgnoredResultsForSecondAssessment"":{11}, ""meanScoreOfFilteredResultsForSecondAssessment"":""{12}"", ""standardDeviationOfFilteredResultsForSecondAssessment"":""{13}"", ""medianScoreOfFilteredResultsForSecondAssessment"":""{14}"", ""quartile0ScoreForSecondAssessment"":""{15}"", ""quartile1ScoreForSecondAssessment"":""{16}"", ""quartile2ScoreForSecondAssessment"":""{17}"", ""quartile3ScoreForSecondAssessment"":""{18}"", ""quartile4ScoreForSecondAssessment"":""{19}"", ""chartData"":[{20}] }}", countOfFilteredResultsForFirstAssessment, countOfIgnoredResultsForFirstAssessment, meanScoreOfFilteredResultsForFirstAssessmentAsString, standardDeviationOfFilteredResultsForFirstAssessmentAsString, medianScoreOfFilteredResultsForFirstAssessmentAsString, q0ScoreForFirstAssessmentAsString, q1ScoreForFirstAssessmentAsString, q2ScoreForFirstAssessmentAsString, q3ScoreForFirstAssessmentAsString, q4ScoreForFirstAssessmentAsString, countOfFilteredResultsForSecondAssessment, countOfIgnoredResultsForSecondAssessment, meanScoreOfFilteredResultsForSecondAssessmentAsString, standardDeviationOfFilteredResultsForSecondAssessmentAsString, medianScoreOfFilteredResultsForSecondAssessmentAsString, q0ScoreForSecondAssessmentAsString, q1ScoreForSecondAssessmentAsString, q2ScoreForSecondAssessmentAsString, q3ScoreForSecondAssessmentAsString, q4ScoreForSecondAssessmentAsString, chartData); return(jsonData); }