Update an existing card
(card_id, json, columns)
| 73 | db.session.commit() |
| 74 | |
| 75 | def update_card(card_id, json, columns): |
| 76 | """Update an existing card""" |
| 77 | card = Card.query.get(card_id) |
| 78 | |
| 79 | modified = False |
| 80 | |
| 81 | if 'text' in json: |
| 82 | modified = True |
| 83 | card.text = json['text'] |
| 84 | |
| 85 | if 'color' in json: |
| 86 | modified = True |
| 87 | card.color = json['color'] |
| 88 | |
| 89 | if 'column' in json: |
| 90 | if json['column'] in columns: |
| 91 | modified = True |
| 92 | card.column = json['column'] |
| 93 | else: |
| 94 | raise Exception("Invalid column name: %s" % json['column']) |
| 95 | |
| 96 | if 'archived' in json: |
| 97 | modified = True |
| 98 | card.archived = json['archived'] |
| 99 | |
| 100 | if modified: |
| 101 | card.modified = datetime.utcnow() |
| 102 | |
| 103 | db.session.commit() |
nothing calls this directly
no outgoing calls
no test coverage detected