forked from CodecoolBase/proman-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_handler.py
More file actions
42 lines (30 loc) · 1.02 KB
/
data_handler.py
File metadata and controls
42 lines (30 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
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 str(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 update_board_title(title, id):
return persistence.update_board_title(title, id)
def update_card_title(title, id):
return persistence.update_card_title(title, id)
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'] == int(board_id):
card['status_id'] = get_card_status(card['status_id']) # Set textual status for the card
matching_cards.append(card)
return matching_cards