'List of previously accepted entries'

@etag
@api.response(NotFoundError)
@api.response(200, model=history_list_schema)
def get(self, session=None):

    args = history_parser.parse_args()
    page = args[u'page']
    per_page = args[u'per_page']
    sort_by = args[u'sort_by']
    sort_order = args[u'order']
    if (per_page > 100):
        per_page = 100
    task = args[u'task']
    query = session.query(History)
    if task:
        query = query.filter((History.task == task))
    total_items = query.count()
    if (not total_items):
        return jsonify([])
    total_pages = int(ceil((total_items / float(per_page))))
    if (page > total_pages):
        raise NotFoundError((u'page    %s    does    not    exist' % page))
    start = ((page - 1) * per_page)
    finish = (start + per_page)
    order = (desc if (sort_order == u'desc') else asc)
    try:
        items = query.order_by(order(getattr(History, sort_by))).slice(start, finish)
    except AttributeError as e:
        raise BadRequest(str(e))
    actual_size = min(items.count(), per_page)
    pagination = pagination_headers(total_pages, total_items, actual_size, request)
    rsp = jsonify([item.to_dict() for item in items])
    rsp.headers.extend(pagination)
    return rsp
