コード例 #1
0
    def display_all_todos(self):
        todos = TodoService.get_todos()

        if not todos:
            is_empty_todos()
            return

        for todo in todos:
            display_msg(todo)
コード例 #2
0
    def check_id_for_update(self, check_id):
        # 서버단에서 Type 에러 체크
        if not is_valid_id(check_id):
            return False

        todos = TodoService.get_todos()

        if todos:
            for i, todo in enumerate(todos):
                if todo.get_id() == check_id:
                    return i
            else:
                is_not_match()
                return -1
        else:
            is_empty_todos()
            return -1
コード例 #3
0
    def register(self, todo_obj):
        # 서버단에서 Type 에러 체크
        if not is_valid_id(todo_obj.get_id()):
            return
        # 서버단에서 Type 에러 체크
        if not is_vaild_what(todo_obj.get_what()):
            return
        # 서버단에서 unique 체크
        todos = TodoService.get_todos()
        check_id = todo_obj.get_id()
        if todos:
            for todo in todos:
                if todo.get_id() == check_id:
                    is_not_unique()
                    return

        TodoService.register(todo_obj)
        did_well()