Example #1
0
        public static double CalculateTotalPointsOnTen(ICollection <FeedbackAttemptViewModel> collection)
        {
            double total = 0;

            foreach (FeedbackAttemptViewModel attempt in collection)
            {
                total += FeedbackAttemptViewModel.CalculatePoints(attempt);
            }


            double onTen = (total * 10) / collection.Count();

            return(onTen);
        }
Example #2
0
        public static double CalculatePoints(FeedbackAttemptViewModel f)
        {
            if (f.correctAnswer.Equals(f.yourAnswer) && f.nbrOfAttempts.Equals(1))
            {
                return(1.0);
            }

            if (f.correctAnswer.Equals(f.yourAnswer) && f.nbrOfAttempts > 1)
            {
                return(0.5);
            }

            return(0.0);
        }