'Calculates partial credit on the Every Decision Counts scheme.
For each correctly selected or correctly blank choice, score 1 point.
Divide by total number of choices.
Arguments:
all_choices, the full set of checkboxes
student_answer, what the student actually chose
student_non_answers, what the student didn\'t choose
Returns a CorrectMap.'

def grade_via_every_decision_counts(self, **kwargs):

    all_choices = kwargs['all_choices']
    student_answer = kwargs['student_answer']
    student_non_answers = kwargs['student_non_answers']
    edc_max_grade = len(all_choices)
    edc_current_grade = 0
    good_answers = sum([1 for answer in student_answer if (answer in self.correct_choices)])
    good_non_answers = sum([1 for blank in student_non_answers if (blank in self.incorrect_choices)])
    edc_current_grade = (good_answers + good_non_answers)
    return_grade = round(((self.get_max_score() * float(edc_current_grade)) / float(edc_max_grade)), 2)
    if (edc_current_grade == edc_max_grade):
        return CorrectMap(self.answer_id, correctness='correct')
    elif (edc_current_grade > 0):
        return CorrectMap(self.answer_id, correctness='partially-correct', npoints=return_grade)
    else:
        return CorrectMap(self.answer_id, correctness='incorrect', npoints=0)
