Пример #1
0
def _build_user_graph(name):
    if name.endswith("lang"):
        name = name[: -len("lang")]
        dist = stats.get_language_data(name)
        return charts.PieChart(dist.items(), max_options=8)

    elif name == "dropout":
        data = stats.get_dropout_figures()
        approx_data = stats.approximate(data)
        chart = charts.MultiLineChart(approx_data, data_name="histogram", x_axis=(0.4, 1.0, 0.1), y_axis=(0, 1.0, 0.1))
        chart.add_data("raw", data)
        return chart

    elif name == "prepostdiff":
        data = [r["pre_post_diff"] for r in stats.get_global_rater_stats() if r["n_tests"] > 2 and r["pre_post_diff"]]
        hist_data = stats.histogram(data, n_bins=11, normalize=False, x_min=-0.7, x_max=0.7)
        chart = charts.LineChart(hist_data, data_name="histogram", x_axis=(-0.8, 0.8, 0.2))
        chart.add_data("raw", data)
        return chart

    elif name == "abilityjlpt3":
        data = stats.get_user_scores("jlpt 3")
        hist_data = stats.histogram(data, x_min=0.0, x_max=1.0, normalize=False)
        chart = charts.LineChart(hist_data, data_name="histogram", x_axis=(0.0, 1.0, 0.1))
        chart.add_data("raw", data)
        return chart

    elif name == "abilityjlpt4":
        data = stats.get_user_scores("jlpt 4")
        hist_data = stats.histogram(data, x_min=0.0, x_max=1.0, normalize=False)
        chart = charts.LineChart(hist_data, data_name="histogram", x_axis=(0.0, 1.0, 0.1))
        chart.add_data("raw", data)
        return chart

    raise KeyError(name)
Пример #2
0
def _build_user_graph(name):
    if name.endswith('lang'):
        name = name[:-len('lang')]
        dist = stats.get_language_data(name)
        return charts.PieChart(dist.items(), max_options=8)

    elif name == 'dropout':
        data = stats.get_dropout_figures()
        approx_data = stats.approximate(data)
        chart = charts.MultiLineChart(approx_data,
                                      data_name='histogram',
                                      x_axis=(0.4, 1.0, 0.1),
                                      y_axis=(0, 1.0, 0.1))
        chart.add_data('raw', data)
        return chart

    elif name == 'prepostdiff':
        data = [
            r['pre_post_diff'] for r in stats.get_global_rater_stats()
            if r['n_tests'] > 2 and r['pre_post_diff']
        ]
        hist_data = stats.histogram(data,
                                    n_bins=11,
                                    normalize=False,
                                    x_min=-0.7,
                                    x_max=0.7)
        chart = charts.LineChart(hist_data,
                                 data_name='histogram',
                                 x_axis=(-0.8, 0.8, 0.2))
        chart.add_data('raw', data)
        return chart

    elif name == 'abilityjlpt3':
        data = stats.get_user_scores('jlpt 3')
        hist_data = stats.histogram(data,
                                    x_min=0.0,
                                    x_max=1.0,
                                    normalize=False)
        chart = charts.LineChart(hist_data,
                                 data_name='histogram',
                                 x_axis=(0.0, 1.0, 0.1))
        chart.add_data('raw', data)
        return chart

    elif name == 'abilityjlpt4':
        data = stats.get_user_scores('jlpt 4')
        hist_data = stats.histogram(data,
                                    x_min=0.0,
                                    x_max=1.0,
                                    normalize=False)
        chart = charts.LineChart(hist_data,
                                 data_name='histogram',
                                 x_axis=(0.0, 1.0, 0.1))
        chart.add_data('raw', data)
        return chart

    raise KeyError(name)
Пример #3
0
def raters(request):
    """
    Displays the top n raters by one of several metrics.
    """
    context = {}
    context["raters"] = stats.get_global_rater_stats()
    n = "n" in request.GET and int(request.GET["n"]) or _default_num_raters
    context["n"] = n
    context["order_by"] = request.REQUEST.get("order_by", "n_responses")
    return render_to_response("analysis/raters.html", context, RequestContext(request))
Пример #4
0
def raters(request):
    """
    Displays the top n raters by one of several metrics.
    """
    context = {}
    context['raters'] = stats.get_global_rater_stats()
    n = 'n' in request.GET and int(request.GET['n']) or _default_num_raters
    context['n'] = n
    context['order_by'] = request.REQUEST.get('order_by', 'n_responses')
    return render_to_response("analysis/raters.html", context,
                              RequestContext(request))