Esempio n. 1
0
def get_tasks():
    #we try to get the search_substring
    search_substring = request.args.get('search_substring')

    #if the search_substring is not set we have to return the full list of tasks
    if search_substring is None:
        # init
        tasks = []

        # get the task list from the db
        task_list = db_interaction.get_tasks()

        # prepare the task list for jsonify
        for item in task_list:
            task = prepare_for_json(item)
            tasks.append(task)

        # return the task data
        return jsonify({'tasks': tasks})
    else:
        #if the search_substring is set we have to return a filtered list of tasks

        # init
        tasks = []

        # get the filtered task list from the db
        task_list = db_interaction.get_filtered_tasks(search_substring)

        # prepare the task list for jsonify
        for item in task_list:
            task = prepare_for_json(item)
            tasks.append(task)

        # return the task data
        return jsonify({'tasks': tasks})
Esempio n. 2
0
def get_tasks():
    #we try to get the search_substring
    search_substring = request.args.get('search_substring')

    #if the search_substring is not set we have to return the full list of tasks
    if search_substring is None:
        # init
        tasks = []

        # get the task list from the db
        task_list = db_interaction.get_tasks()

        # prepare the task list for jsonify
        for item in task_list:
            task = prepare_for_json(item)
            tasks.append(task)

        # return the task data
        return jsonify({'tasks': tasks})
    else:
        #if the search_substring is set we have to return a filtered list of tasks

        # init
        tasks = []

        # get the filtered task list from the db
        task_list = db_interaction.get_filtered_tasks(search_substring)

        # prepare the task list for jsonify
        for item in task_list:
            task = prepare_for_json(item)
            tasks.append(task)

        # return the task data
        return jsonify({'tasks': tasks})
Esempio n. 3
0
def get_tasks():
    result = db_interaction.get_tasks()
    tasks = []

    for item in result:
        task = prepare_json(item)
        tasks.append(task)

    return jsonify({'tasks': tasks})
Esempio n. 4
0
def get_tasks():
    # init
    tasks = []

    # get the task list from the db
    task_list = db_interaction.get_tasks()

    # prepare the task list for jsonify
    for item in task_list:
        task = prepare_for_json(item)
        tasks.append(task)

    # return the task data
    return jsonify({'tasks': tasks})
Esempio n. 5
0
def get_tasks():
    # init
    tasks = []

    # get the task list from the db
    task_list = db_interaction.get_tasks()

    # prepare the task list for jsonify
    for item in task_list:
        task = prepare_for_json(item)
        tasks.append(task)

    # return the task data
    return jsonify({'tasks': tasks})
Esempio n. 6
0
def index():
    tasks_list = db_interaction.get_tasks()
    return render_template('index.html', tasks_list=tasks_list)