@post('/s/sets/{set_id}/units/{unit_id}')
def choose_unit_route(request, set_id, unit_id):

    # TODO-3 simplify this method. should it be broken up or moved to model?
    db_conn = request['db_conn']

    current_user = get_current_user(request)
    if not current_user:
        return abort(401)

    unit = Unit.get_latest_accepted(db_conn, unit_id)
    if not unit:
        return abort(404)

    # If the unit isn't in the set...
    context = current_user.get_learning_context()
    set_ids = [set_['entity_id']
               for set_ in Set.list_by_unit_id(db_conn, unit_id)]
    if context.get('set', {}).get('entity_id') not in set_ids:
        return abort(400)

    status = judge(db_conn, unit, current_user)
    # Or, the unit doesn't need to be learned...
    if status == "done":
        return abort(400)

    # Choose a card for the learner to learn
    card = choose_card(db_conn, current_user, unit)

    if card:
        next_ = {
            'method': 'GET',
            'path': '/s/cards/{card_id}/learn'
                    .format(card_id=card['entity_id']),
        }
    else:
        next_ = {}

    current_user.set_learning_context(
        unit=unit.data,
        card=card.data if card else None,
        next=next_
    )

    return 200, {'next': next_}
prepare option to display out in quick panel
dataset/ETHPy150Open heiskr/sagefy/server/routes/set.py/choose_unit_route--crossover with--dataset/ETHPy150Open srusskih/SublimeJEDI/sublime_jedi/go_to.py/BaseLookUpJediCommand.prepare_option