示例#1
0
def get_boards():
    """
    Gather all boards
    :return:
    """
    boards = persistence.get_boards()

    return boards
示例#2
0
def new_board():
    boards = persistence.get_boards()
    new_id = get_new_id(boards)
    new_board_title = request.form["new-board-name"]
    if new_board_title == "":
        persistence.append_boards(new_id)
    else:
        persistence.append_boards(new_id, new_board_title)
    return redirect(url_for('index'))
示例#3
0
def get_boards(username='******'):
    boards = persistence.get_boards(force=True)
    boards_to_show = []
    for board in boards:
        # public boards
        if int(board['private']) == 0:
            boards_to_show.append(board)
        elif board['creator'] == username:
            boards_to_show.append(board)
    return boards_to_show
示例#4
0
def get_boards(name, password):
    """
    Gather all boards
    :return:
    """
    persistence.clear_cache()
    all_boards = persistence.get_boards()
    user = get_user(name, password)
    matching_boards = []
    for board in all_boards:
        if user['user_id'] == all_boards['user_id']:
            matching_boards.append(board)
    return matching_boards
示例#5
0
def add_board(board_name, creator_username="******", private=0):
    new_board = {
        "id": persistence.new_id_to_csv(persistence.BOARDS_FILE),
        "title": board_name,
        "creator": creator_username,
        "private": private
    }
    persistence.get_boards().append(new_board)
    persistence.export_data("boards")

    # add starter statuses to new boards
    starter_statuses = [{
        'board_id':
        new_board['id'],
        'status_id':
        i,
        'order':
        persistence.new_order_number_to_board_status_connections(
            new_board['id'], i)
    } for i in range(0, 4)]
    board_status_connections = persistence.get_status_board_connections()
    for connection in starter_statuses:
        board_status_connections.append(connection)
    persistence.export_data('board_statuses')
示例#6
0
def get_boards(user_id=None):
    """
    Gather all boards
    :return:
    """
    all_boards = persistence.get_boards(force=True)
    boards_for_user = []
    public_boards = []
    if user_id is not None:
        for board in all_boards:
            if board['user_id'] == str(user_id) or board['user_id'] == "":
                boards_for_user.append(board)
        return boards_for_user
    else:
        for board in all_boards:
            if board['user_id'] == "":
                public_boards.append(board)
        return public_boards
示例#7
0
def delete_board(board_id):
    # delete board from boards.csv
    boards = persistence.get_boards()
    for board in boards:
        if board['id'] == str(board_id):
            boards.remove(board)
    persistence.export_data('boards')

    # delete board status connections to this board
    connections = persistence.get_status_board_connections()
    for conn in connections:
        if conn['board_id'] == str(board_id):
            connections.remove(conn)
    persistence.export_data('board_statuses')

    # delete cards connected to this boards
    cards = persistence.get_cards()
    for card in cards:
        if card['board_id'] == str(board_id):
            cards.remove(card)
    persistence.export_data('cards')
示例#8
0
def get_boards():
    """
    Gather all boards
    :return:
    """
    return persistence.get_boards(force=True)
示例#9
0
def get_board_by_id(board_id):
    boards = persistence.get_boards()
    # returns the board title
    return [
        board["title"] for board in boards if board["id"] == str(board_id)
    ][0]
示例#10
0
def rename_board(board_id, new_name):
    for board in persistence.get_boards():
        if int(board["id"]) == board_id:
            board["title"] = new_name
    persistence.export_data("boards")
示例#11
0
def get_boards(user_id):
    """
    Gather all boards
    :return:
    """
    return persistence.get_boards(user_id)
示例#12
0
def save_new_board(title):
    boards = persistence.get_boards()
    last_board_id = boards[-1]["id"]
    new_id = int(last_board_id) + 1
    return persistence.save_new_board(new_id, title)
示例#13
0
def rename_board(status_data):
    boards = persistence.get_boards(force=True)
    old_value = status_data['boardTitle']
    new_value = status_data['newValue']
    renamed_board = persistence.rename_board(boards, old_value, new_value)
    return renamed_board
def get_board_by_id(board_id):
    boards = persistence.get_boards(force=True)
    for board in boards:
        if board.get("id") == str(board_id):
            return board