Example #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)
Example #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)
Example #3
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)