Esempio n. 1
0
    def report(author, extra):
        '''Summarize the student's performance'''
        expected['_score'] = 0.0
        correct = 0
        problems = 0
        answered = 0
        choice = 0
        choice_points = 0
        total_choice_points = 0
        points = 0
        max_points = 0
        for tag in sorted(expected.keys()):
            if tag.startswith('_'):
                continue
            print(tag)
            problems += 1
            c = expected[tag]['correct']
            if 'choice' in expected[tag]['extra']:
                choice += 1
                if c > 0:
                    answered += 1
                    choice_points += expected[tag]['points']
                total_choice_points += expected[tag]['points']
                max_points = expected[tag]['points']
                continue

            if c > 0:
                correct += c
                points += expected[tag]['points'] * c
                if c < 1:
                    print(tag, 'partially incorrect')
            else:
                print(tag, 'incorrect')
            max_points += expected[tag]['points']
        if '_author' in expected and author == expected['_author']:
            print('You must fill in your onyen into the author variable at the top of the script')
            return
        if '_exam' in expected and expected['_exam']:
            if not extra:
                print('You must type your name as the value of the pledge variable')
                return
            else:
                print("  Pledged on my honor:", extra)
                print("   ", getpass.getuser())

        elif '_collaborators' in expected and extra == expected['_collaborators']:
            print('You must fill in the collaborators variable')
            return
        else:
            print("  Collaborators:", extra)
        print("Report for", author)
        if total_choice_points > 0:
            print("  %d of %d answered for up to %d points" % (answered, choice, choice_points))
        print("  %d of %d correct, %d of %d points" % (correct, problems-choice,
            points, max_points-total_choice_points))
        expected['_score'] = points

        record_grade(expected)

        return showSubmitButton()
Esempio n. 2
0
    def report(author, extra):
        '''Summarize the student's performance'''
        expected['_score'] = 0.0
        correct = 0
        problems = 0
        answered = 0
        points = 0
        max_points = 0
        for tag in tagSort(expected.keys()):
            if tag.startswith('_'):
                continue
            problems += 1
            c = expected[tag]['correct']

            if c > 0:
                correct += c
                points += expected[tag]['points'] * c
                if c < 1:
                    print(tag, 'partially incorrect')
                else:
                    print(tag, 'appears correct')
            else:
                print(tag, 'incorrect')
            max_points += expected[tag]['points']
        if '_author' in expected and author == expected['_author']:
            print('You must fill in your onyen into the author variable.')
            return
        print("Report for", author)

        if '_exam' in expected and expected['_exam']:
            if not extra:
                print(
                    'You must type your name as the value of the pledge variable.'
                )
                return
            else:
                print("  Pledged on my honor:", extra)
                print("   ", getpass.getuser())

        elif '_collaborators' in expected and extra == expected[
                '_collaborators']:
            print('You must fill in the collaborators variable')
            return
        else:
            print("  Collaborators:", extra)
        print("  {} of {} possibly correct for up to {} of {} points".format(
            correct, problems, points, max_points))
        expected['_score'] = points

        record_grade(expected)

        return showSubmitButton()
Esempio n. 3
0
    def report(author, extra):
        """Summarize the student's performance"""
        expected["_score"] = 0.0
        correct = 0
        problems = 0
        answered = 0
        choice = 0
        choice_points = 0
        total_choice_points = 0
        points = 0
        max_points = 0
        for tag in tagSort(expected.keys()):
            if tag.startswith("_"):
                continue
            problems += 1
            c = expected[tag]["correct"]
            if "choice" in expected[tag]["extra"]:
                choice += 1
                if c > 0:
                    answered += 1
                    choice_points += expected[tag]["points"]
                else:
                    print(tag, "not answered")
                total_choice_points += expected[tag]["points"]
                max_points += expected[tag]["points"]
                continue

            if c > 0:
                correct += c
                points += expected[tag]["points"] * c
                if c < 1:
                    print(tag, "partially incorrect")
            else:
                print(tag, "incorrect")
            max_points += expected[tag]["points"]
        if "_author" in expected and author == expected["_author"]:
            print(
                "You must fill in your onyen into the author variable at the top of the script"
            )
            return
        if "_exam" in expected and expected["_exam"]:
            if not extra:
                print("You must type your name as the value of the pledge variable")
                return
            else:
                print("  Pledged on my honor:", extra)
                print("   ", getpass.getuser())

        elif "_collaborators" in expected and extra == expected["_collaborators"]:
            print("You must fill in the collaborators variable")
            return
        else:
            print("  Collaborators:", extra)
        print("Report for", author)
        if total_choice_points > 0:
            print(
                "  %d of %d answered for up to %d points"
                % (answered, choice, choice_points)
            )
        print(
            "  %d of %d appear correct, %d of %d points"
            % (correct, problems - choice, points, max_points - total_choice_points)
        )
        expected["_score"] = points

        record_grade(expected)