-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathdata_handler.py
More file actions
34 lines (26 loc) · 862 Bytes
/
data_handler.py
File metadata and controls
34 lines (26 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import persistence
def get_card_status(status_id):
"""
Find the first status matching the given id
:param status_id:
:return: str
"""
statuses = persistence.get_statuses()
return next((status['title'] for status in statuses if status['id'] == str(status_id)), 'Unknown')
def get_boards():
"""
Gather all boards
:return:
"""
return persistence.get_boards(force=True)
def add_new_board(title):
return persistence.add_new_board(title)
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