Пример #1
0
def get_boards():
    """
    Gather all boards
    :return:
    """
    persistence.clear_cache()
    return persistence.get_all_boards()
Пример #2
0
def get_columns_by_id(board_id):
    persistence.clear_cache()
    all_columns = persistence.get_columns(force=True)
    matching_columns = []
    for column in all_columns:
        if column['board_id'] == str(board_id):
            matching_columns.append(column)
    return matching_columns
Пример #3
0
def get_cards_for_board(board_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards()
    matching_cards = []
    for card in all_cards:
        if card['board_id'] == str(board_id):
            card['status_id'] = get_card_status(card['status_id'])  # Set textual status for the card
            matching_cards.append(card)
    return matching_cards
Пример #4
0
def get_cards_for_board_and_status(board_id, status_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards()
    matching_cards = []
    for card in all_cards:
        if (card['board_id'] == str(board_id)
                and card['status_id'] == str(status_id)
                and card['archived'] == '0'):
            card['status_id'] = get_card_status(card['status_id'])
            matching_cards.append(card)
    return matching_cards
Пример #5
0
def save_dict_to_cards_csv(dictionary):
    if len(dictionary) > 0:
        persistence.clear_cache()
        keys = dictionary[0].keys()
        with open(persistence.CARDS_FILE, 'w', newline='') as output_file:
            dict_writer = csv.DictWriter(output_file, keys)
            dict_writer.writeheader()
            dict_writer.writerows(dictionary)
    else:
        f = open(persistence.CARDS_FILE, "w+")
        f.close()
Пример #6
0
def get_cards_for_board(board_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards()

    matching_cards = []
    for card in all_cards:

        if int(card['board_id']) == int(board_id):
            print(board_id)
            matching_cards.append(card)

    return matching_cards
Пример #7
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
Пример #8
0
def get_cards_for_board(board_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards()

    # to rewrite with SQL

    # matching_cards = []
    # for card in all_cards:
    #     if card['board_id'] == str(board_id):
    #         card['status_id'] = get_card_status(card['status_id'])  # Set textual status for the card
    #         matching_cards.append(card)

    return matching_cards
Пример #9
0
def get_cards_for_board(board_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards()
    matching_cards = []
    for card in all_cards:
        if card['board_id'] == str(board_id):
            matching_cards.append(card)

    ordered_matching_cards = sorted(
        matching_cards,
        key=lambda card: (int(card['status_id']), int(card['order'])))
    for card in ordered_matching_cards:
        print(card)
    return ordered_matching_cards
Пример #10
0
def get_cards_for_board(board_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards(board_id)
    return all_cards
Пример #11
0
def get_statuses():
    persistence.clear_cache()
    return persistence.get_statuses()
Пример #12
0
def get_card_by_id(card_id):
    persistence.clear_cache()
    all_cards = persistence.get_cards(force=True)
    for card in all_cards:
        if card['id'] == str(card_id):
            return card
Пример #13
0
def get_cards():
    persistence.clear_cache()
    return persistence.get_cards()
Пример #14
0
def get_user(name, password):
    persistence.clear_cache()
    all_users = persistence.get_users()
    for user in all_users:
        if user['name'] == str(name) and user['password'] == str(password):
            return user