Esempio n. 1
0
        private void CalculateGrade(ScoreEntity scoreToCalculate)
        {
            var wizard = new ScoreWizard();

            var result = wizard.GetSingleScoreResult(scoreToCalculate.PointsEarned, scoreToCalculate.PointsPossible);

            scoreToCalculate.PointsGrade = result.GradeRaw;
        }
Esempio n. 2
0
        private void CalculateGrade(EvaluationEntity evaluationToGrade)
        {
            var wizard      = new EvaluationWizard();
            var scoreWizard = new ScoreWizard();

            var evalSpell = new EvaluationResult
            {
                TotalScoreCount    = evaluationToGrade.NumberOfScores,
                DropLowest         = evaluationToGrade.DropLowest,
                DropLowestCount    = evaluationToGrade.NumberToDrop,
                PointValuePerScore = evaluationToGrade.PointsPerScore
            };

            var scores = ScoreInteractor.GetScoresByEvaluationId(evaluationToGrade.Id);

            var scoreSpells = new List <ScoreResult>();

            if (scores.Count > 0)
            {
                foreach (var scoreEntity in scores)
                {
                    scoreSpells.Add(scoreWizard.GetSingleScoreResult(scoreEntity.PointsEarned, scoreEntity.PointsPossible));
                }

                evalSpell.Scores = scoreSpells;

                wizard.Evaluation = evalSpell;

                wizard.UpdateAllGrades();

                evaluationToGrade.PointsEarned          = wizard.Evaluation.PointsEarned;
                evaluationToGrade.CurrentPointsPossible = wizard.Evaluation.PointsPossibleToDate;
                evaluationToGrade.TotalPointsPossible   = wizard.Evaluation.PointsPossibleOverall;
                evaluationToGrade.CurrentPointsGrade    = wizard.Evaluation.GradeToDateRaw;
                evaluationToGrade.FinalPointsGrade      = wizard.Evaluation.GradeOverallRaw;
            }
            else
            {
                var pointsTotal = (evaluationToGrade.NumberOfScores -
                                   evaluationToGrade.NumberToDrop) * evaluationToGrade.PointsPerScore;

                evaluationToGrade.CurrentPointsGrade    = 1;
                evaluationToGrade.FinalPointsGrade      = 0;
                evaluationToGrade.PointsEarned          = 0;
                evaluationToGrade.CurrentPointsPossible = pointsTotal;
                evaluationToGrade.TotalPointsPossible   = pointsTotal;
            }
        }