예제 #1
0
def _save_level(world, challengeNo):

    old_xp = calculate_xp()
    needsToSave = False

    groups = load_app_state_variable(APP_NAME, 'groups')

    # We might need to load the worlds file here so that we're sure that
    # no one is abusing the API from the OS
    if groups is None:
        groups = {}

    if world in groups:
        if groups[world]['challengeNo'] < challengeNo:
            groups[world]['challengeNo'] = challengeNo
            needsToSave = True

    else:
        groups[world] = {'challengeNo': challengeNo}
        needsToSave = True

    if needsToSave:
        save_app_state_variable_with_dialog(APP_NAME, 'groups', groups)

    new_xp = calculate_xp()
    return str(new_xp - old_xp)
예제 #2
0
파일: server.py 프로젝트: etamity/make-art
def _save_level(world, challengeNo):

    old_xp = calculate_xp()
    needsToSave = False

    groups = load_app_state_variable(APP_NAME, 'groups')

    # We might need to load the worlds file here so that we're sure that
    # no one is abusing the API from the OS
    if groups is None:
        groups = {}

    if world in groups:
        if groups[world]['challengeNo'] < challengeNo:
            groups[world]['challengeNo'] = challengeNo
            needsToSave = True

    else:
        groups[world] = {'challengeNo': challengeNo}
        needsToSave = True

    if needsToSave:
        save_app_state_variable_with_dialog(APP_NAME, 'groups', groups)

    new_xp = calculate_xp()
    return str(new_xp - old_xp)
예제 #3
0
 def next(self):
     from kano_profile.badges import save_app_state_variable_with_dialog
     save_app_state_variable_with_dialog('linux-story', 'finished',
                                         'challenge_46')
     self._is_finished = True
     self.exit()
     return -1, -1
예제 #4
0
def _save_level(level):
    old_xp = calculate_xp()

    value = int(level) - 1

    save_app_state_variable_with_dialog(APP_NAME, 'level', value)
    new_xp = calculate_xp()

    return str(new_xp - old_xp)
예제 #5
0
    def save_challenge(self):
        '''Integration with kano world
        '''
        level = load_app_state_variable("linux-story", "level")

        if self.challenge_number > level:
            save_app_state_variable_with_dialog("linux-story", "level",
                                                self.challenge_number)
            self.get_xp()
예제 #6
0
    def save_challenge(self):
        '''Integration with kano world
        '''
        level = load_app_state_variable("linux-story", "level")

        if self.challenge_number > level:
            save_app_state_variable_with_dialog("linux-story", "level",
                                                self.challenge_number)
            self.get_xp()
예제 #7
0
def _save_level(level):
    old_xp = calculate_xp()

    value = int(level) - 1

    save_app_state_variable_with_dialog(APP_NAME, 'level', value)
    new_xp = calculate_xp()

    return str(new_xp - old_xp)
예제 #8
0
 def next(self):
     from kano_profile.badges import save_app_state_variable_with_dialog
     save_app_state_variable_with_dialog('linux-story', 'finished', 'challenge_46')
     self._is_finished = True
     self.exit()
     return -1, -1
예제 #9
0
 def __save_challenge(new_challenge, challenge):
     if new_challenge > challenge or not new_challenge:
         level = load_app_state_variable("linux-story", "level")
         if challenge > level:
             save_app_state_variable_with_dialog("linux-story", "level", challenge)