Exemplo n.º 1
0
def get_card(card_index, project_id):

    '''Using the cards index, send back all information pertaining to the card
    Used primarily for the card details page'''

    card_refrence = Card()
    card_refrence.index = card_index

    card = card_select.card(project_id, card_refrence.proj_number())

    if card.type is CardType(0).name:
        steps = card_select.card_steps(card.id)
        card.add_steps(steps)

    elif card.type is CardType(1).name:
        assigned_cards = card_select.cards_assigned_to_epic(card.epic.id)
        card.add_assigned_cards(assigned_cards)

    return response.success(card.serialize())
Exemplo n.º 2
0
def update_card_steps(card_id):

    '''Updates the steps of the provided card,
    then returns the value from the database'''

    steps_form = json.loads(request.form['payload'])
    steps = create_objects_from_form_array(Step, steps_form) 

    updated_steps = []
    new_steps = []

    for step in steps:
        if step.id > 0:
            updated_steps.append(step)
        else:
            new_steps.append(step)

    card_update.steps(updated_steps)
    card_insert.steps_for(card_id, new_steps)

    steps = card_select.card_steps(card_id)

    return response.success(serialize_array(steps))