コード例 #1
0
ファイル: views.py プロジェクト: adaptive-learning/flocs
def post_flow_report(request):
    """Store and process flow_report after a task is solved.

    POST params:
        task-instance-id: int,
        flow-report:  0=unknown, 1=very_difficult, 2=difficult,
                      3=just_right, 4=easy
    """
    if request.method != "POST":
        return HttpResponseBadRequest('Has to be POST request.')
    logger.log_request(request)
    body_unicode = request.body.decode('utf-8')
    data = json.loads(body_unicode)
    result = practice_service.process_flow_report(
            user=request.user,
            task_instance_id=data['task-instance-id'],
            reported_flow=FlowRating.from_key(data.get('flow-report')))
    return HttpResponse('ok')
コード例 #2
0
def post_flow_report(request):
    """Store and process flow_report after a task is solved.

    POST params:
        task-instance-id: int,
        flow-report:  0=unknown, 1=very_difficult, 2=difficult,
                      3=just_right, 4=easy
    """
    if request.method != "POST":
        return HttpResponseBadRequest('Has to be POST request.')
    logger.log_request(request)
    body_unicode = request.body.decode('utf-8')
    data = json.loads(body_unicode)
    result = practice_service.process_flow_report(
        user=request.user,
        task_instance_id=data['task-instance-id'],
        reported_flow=FlowRating.from_key(data.get('flow-report')))
    return HttpResponse('ok')
コード例 #3
0
def sum_flow_time(tasks):
    total_time = sum(task.time for task in tasks
                     if FlowRating.from_key(task.flow) == FlowRating.RIGHT)
    return total_time
コード例 #4
0
def sum_flow_time(tasks):
    total_time = sum(task.time for task in tasks
                     if FlowRating.from_key(task.flow) == FlowRating.RIGHT)
    return total_time