Пример #1
0
    def _exam_complete(self, exam_id, answered, correct):
        """Updates challenge results with completed exam grade"""

        repo = ChallengeRepo()

        #'try any exam' challenge is complete
        result = repo.get_result(BUNDLE_ID, try_exam_chal)
        result.set_result(True)
        repo.set_result(BUNDLE_ID, try_exam_chal, result)

        percent_correct = 100 * correct / answered

        if exam_id == "easy":
            challenge_id = easy_chal
        elif exam_id == "intermediate":
            challenge_id = intm_chal
        elif exam_id == "advanced":
            challenge_id = adv_chal

        result = repo.get_result(BUNDLE_ID, challenge_id)
        if result.get_result() is None:
            result.set_result(percent_correct)
            repo.set_result(BUNDLE_ID, challenge_id, result)
        elif percent_correct > result.get_result():
            result.set_result(percent_correct)
            repo.set_result(BUNDLE_ID, challenge_id, result)
Пример #2
0
    def _exam_complete(self, exam_id, answered, correct):
        """Updates challenge results with completed exam grade"""
        
        repo = ChallengeRepo()
        
        #'try any exam' challenge is complete
        result = repo.get_result(BUNDLE_ID, try_exam_chal)
        result.set_result(True)
        repo.set_result(BUNDLE_ID, try_exam_chal, result)
        
        
        percent_correct = 100 * correct / answered
        
        if exam_id == "easy":
            challenge_id = easy_chal
        elif exam_id == "intermediate":
            challenge_id = intm_chal
        elif exam_id == "advanced":
            challenge_id = adv_chal

        result = repo.get_result(BUNDLE_ID, challenge_id)
        if result.get_result() is None:
            result.set_result(percent_correct)
            repo.set_result(BUNDLE_ID, challenge_id, result)
        elif percent_correct > result.get_result():
                result.set_result(percent_correct)
                repo.set_result(BUNDLE_ID, challenge_id, result)
Пример #3
0
    def __init__(self, handle):
        # This runs the constructor for an activity
        activity.Activity.__init__(self, handle)
        
        # Creates the standard activity Toolbox.
        toolbox = activity.ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()
        
        # Create the main mathogen tutorial window
        self.layout = MathogenTuteGui()
        self.set_canvas(self.layout)

        repository = ChallengeRepo()
        repository.update_challenges(mathogen_tute.BUNDLE_ID, mathogen_tute.challenges)
Пример #4
0
 def challenge_complete(self, challenge_name):
     repo = ChallengeRepo()
     result = repo.get_result(BUNDLE_ID, challenge_name)
     result.set_result(True)
     repo.set_result(BUNDLE_ID, challenge_name, result)