Exemple #1
0
def show_stats(deposition_type):
    """Render the stats for all the depositions."""
    if len(DepositionType.keys()) <= 1 and \
       DepositionType.get_default() is not None:
        abort(404)

    form = FilterDateForm()

    deptype = DepositionType.get(deposition_type)
    submitted_depositions = [d for d in Deposition.get_depositions(type=deptype) if d.has_sip(sealed=True)]

    ctx = process_metadata_for_charts(submitted_depositions,
                                      group_by=request.args.get('group_by', 'type_of_doc'))
    ctx.update(dict(
        deposition_type=deptype,
        depositions=submitted_depositions,
        form=form,
        chart_types=CHART_TYPES
    ))

    return render_template('deposit/stats/all_depositions.html', **ctx)