Esempio n. 1
0
def timing_metrics(request):
    """
    Request is an HTTP get request with the following keys:
        Course_id
        Grader_type
        Location
    """

    if request.method != "POST":
        return util._error_response("Must make a POST request.", _INTERFACE_VERSION)

    arguments,title=metrics_util.get_arguments(request)
    success, response=metrics_util.generate_timing_response(arguments,title)

    if not success:
        return util._error_response(str(response),_INTERFACE_VERSION)

    return util._success_response({'img' : response}, _INTERFACE_VERSION)
Esempio n. 2
0
def timing_metrics(request):
    """
    Request is an HTTP get request with the following keys:
        Course_id
        Grader_type
        Location
    """

    if request.method != "POST":
        return util._error_response("Must make a POST request.", _INTERFACE_VERSION)

    arguments,title=metrics_util.get_arguments(request)
    success, response=metrics_util.generate_timing_response(arguments,title)

    if not success:
        return util._error_response(str(response),_INTERFACE_VERSION)

    return util._success_response({'img' : response}, _INTERFACE_VERSION)
Esempio n. 3
0
def metrics_form(request):

    if request.method == "POST":

        tags=['metric_type']
        for tag in tags:
            if tag not in request.POST:
                return HttpResponse("Request missing needed tag metric type.")

        arguments,title=metrics_util.get_arguments(request)
        metric_type=request.POST.get('metric_type').lower()
        success,response = metrics_util.render_requested_metric(metric_type,arguments,title, type="jquery")

        return response

    elif request.method == "GET":
        available_metric_types = [k for k in metrics_util.AVAILABLE_METRICS]
        rendered=metrics_util.render_form("metrics/metrics/",available_metric_types)
        return HttpResponse(rendered)
Esempio n. 4
0
def metrics_form(request):

    if request.method == "POST":

        tags=['metric_type']
        for tag in tags:
            if tag not in request.POST:
                return HttpResponse("Request missing needed tag metric type.")

        arguments,title=metrics_util.get_arguments(request)
        metric_type=request.POST.get('metric_type').lower()
        success,response = metrics_util.render_requested_metric(metric_type,arguments,title, type="jquery")

        return response

    elif request.method == "GET":
        available_metric_types = [k for k in metrics_util.AVAILABLE_METRICS]
        rendered=metrics_util.render_form("metrics/metrics/",available_metric_types)
        return HttpResponse(rendered)