Exemple #1
0
        private static string GetPreTestPostTestChartData(string assessmentName, QuartileScores quartileScores)
        {
            var tooltip = string.Format(
                "Quartile 4: {0}<br/>" +
                "Quartile 3: {1}<br/>" +
                "Quartile 2: {2}<br/>" +
                "Quartile 1: {3}<br/>" +
                "Quartile 0: {4}",
                !double.IsNaN(quartileScores.Quartile4Score) ? string.Format("{0:F1}%", quartileScores.Quartile4Score) : "-",
                !double.IsNaN(quartileScores.Quartile3Score) ? string.Format("{0:F1}%", quartileScores.Quartile3Score) : "-",
                !double.IsNaN(quartileScores.Quartile2Score) ? string.Format("{0:F1}%", quartileScores.Quartile2Score) : "-",
                !double.IsNaN(quartileScores.Quartile1Score) ? string.Format("{0:F1}%", quartileScores.Quartile1Score) : "-",
                !double.IsNaN(quartileScores.Quartile0Score) ? string.Format("{0:F1}%", quartileScores.Quartile0Score) : "-"
                );

            var chartData = string.Format(@"[""{0}"",{1},{2},{3},{4},""{5}""],",
                                          assessmentName,
                                          !double.IsNaN(quartileScores.Quartile0Score) ? Math.Round(quartileScores.Quartile0Score, 1, MidpointRounding.AwayFromZero) : 0,
                                          !double.IsNaN(quartileScores.Quartile1Score) ? Math.Round(quartileScores.Quartile1Score, 1, MidpointRounding.AwayFromZero) : 0,
                                          !double.IsNaN(quartileScores.Quartile3Score) ? Math.Round(quartileScores.Quartile3Score, 1, MidpointRounding.AwayFromZero) : 0,
                                          !double.IsNaN(quartileScores.Quartile4Score) ? Math.Round(quartileScores.Quartile4Score, 1, MidpointRounding.AwayFromZero) : 0,
                                          tooltip
                                          );

            return(chartData);
        }
Exemple #2
0
        private static QuartileScores GetQuartileScores(List <Result> results)
        {
            var quartileScores = new QuartileScores();

            if (results.Count > 0)
            {
                var orderedResults = results.OrderBy(r => r.ResultPercentageScore).ToList();

                var lowRangeStart  = 0;
                var lowRangeEnd    = orderedResults.Count / 2;
                var highRangeStart = orderedResults.Count / 2;
                var highRangeEnd   = orderedResults.Count - 1;

                if (orderedResults.Count % 2 == 0)
                {
                    // even number of results so slightly adjust the ranges
                    lowRangeEnd -= 1;
                }

                var lowRange = new List <Result>();
                for (int i = lowRangeStart; i <= lowRangeEnd; i++)
                {
                    lowRange.Add(orderedResults[i]);
                }
                var highRange = new List <Result>();
                for (int i = highRangeStart; i <= highRangeEnd; i++)
                {
                    highRange.Add(orderedResults[i]);
                }

                quartileScores.Quartile0Score = orderedResults[lowRangeStart].ResultPercentageScore;
                quartileScores.Quartile1Score = GetMedianScore(lowRange);
                quartileScores.Quartile2Score = GetMedianScore(orderedResults);
                quartileScores.Quartile3Score = GetMedianScore(highRange);
                quartileScores.Quartile4Score = orderedResults[highRangeEnd].ResultPercentageScore;
            }

            return(quartileScores);
        }
        private static QuartileScores GetQuartileScores(List<Result> results)
        {
            var quartileScores = new QuartileScores();

            if (results.Count > 0)
            {
                var orderedResults = results.OrderBy(r => r.ResultPercentageScore).ToList();

                var lowRangeStart = 0;
                var lowRangeEnd = orderedResults.Count / 2;
                var highRangeStart = orderedResults.Count / 2;
                var highRangeEnd = orderedResults.Count - 1;

                if (orderedResults.Count % 2 == 0)
                {
                    // even number of results so slightly adjust the ranges
                    lowRangeEnd -= 1;
                }

                var lowRange = new List<Result>();
                for (int i = lowRangeStart; i <= lowRangeEnd; i++)
                {
                    lowRange.Add(orderedResults[i]);
                }
                var highRange = new List<Result>();
                for (int i = highRangeStart; i <= highRangeEnd; i++)
                {
                    highRange.Add(orderedResults[i]);
                }

                quartileScores.Quartile0Score = orderedResults[lowRangeStart].ResultPercentageScore;
                quartileScores.Quartile1Score = GetMedianScore(lowRange);
                quartileScores.Quartile2Score = GetMedianScore(orderedResults);
                quartileScores.Quartile3Score = GetMedianScore(highRange);
                quartileScores.Quartile4Score = orderedResults[highRangeEnd].ResultPercentageScore;
            }

            return quartileScores;
        }
        private static string GetPreTestPostTestChartData(string assessmentName, QuartileScores quartileScores)
        {
            var tooltip = string.Format(
                "Quartile 4: {0}<br/>" +
                "Quartile 3: {1}<br/>" +
                "Quartile 2: {2}<br/>" +
                "Quartile 1: {3}<br/>" +
                "Quartile 0: {4}",
                !double.IsNaN(quartileScores.Quartile4Score) ? string.Format("{0:F1}%", quartileScores.Quartile4Score) : "-",
                !double.IsNaN(quartileScores.Quartile3Score) ? string.Format("{0:F1}%", quartileScores.Quartile3Score) : "-",
                !double.IsNaN(quartileScores.Quartile2Score) ? string.Format("{0:F1}%", quartileScores.Quartile2Score) : "-",
                !double.IsNaN(quartileScores.Quartile1Score) ? string.Format("{0:F1}%", quartileScores.Quartile1Score) : "-",
                !double.IsNaN(quartileScores.Quartile0Score) ? string.Format("{0:F1}%", quartileScores.Quartile0Score) : "-"
                );

            var chartData = string.Format(@"[""{0}"",{1},{2},{3},{4},""{5}""],",
                assessmentName,
                !double.IsNaN(quartileScores.Quartile0Score) ? Math.Round(quartileScores.Quartile0Score, 1, MidpointRounding.AwayFromZero) : 0,
                !double.IsNaN(quartileScores.Quartile1Score) ? Math.Round(quartileScores.Quartile1Score, 1, MidpointRounding.AwayFromZero) : 0,
                !double.IsNaN(quartileScores.Quartile3Score) ? Math.Round(quartileScores.Quartile3Score, 1, MidpointRounding.AwayFromZero) : 0,
                !double.IsNaN(quartileScores.Quartile4Score) ? Math.Round(quartileScores.Quartile4Score, 1, MidpointRounding.AwayFromZero) : 0,
                tooltip
                );

            return chartData;
        }
        private static string GetPreTestPostTestChartData(string nameForFirstAssessment, QuartileScores quartileScoresForFirstAssessment, string nameForSecondAssessment, QuartileScores quartileScoresForSecondAssessment)
        {
            var chartData = string.Empty;

            chartData += GetPreTestPostTestChartData(nameForFirstAssessment, quartileScoresForFirstAssessment);
            chartData += GetPreTestPostTestChartData(nameForSecondAssessment, quartileScoresForSecondAssessment);

            chartData = chartData.TrimEnd(',');

            return chartData;
        }
Exemple #6
0
        private static string GetPreTestPostTestChartData(string nameForFirstAssessment, QuartileScores quartileScoresForFirstAssessment, string nameForSecondAssessment, QuartileScores quartileScoresForSecondAssessment)
        {
            var chartData = string.Empty;

            chartData += GetPreTestPostTestChartData(nameForFirstAssessment, quartileScoresForFirstAssessment);
            chartData += GetPreTestPostTestChartData(nameForSecondAssessment, quartileScoresForSecondAssessment);

            chartData = chartData.TrimEnd(',');

            return(chartData);
        }