Пример #1
0
def submit_answer():
    pair_id = request.form.get('pair_id')
    preferred_doc_id = request.form.get('preferred')
    pair_submitted = DBProxy.submit_doc_pair(pair_id=pair_id,
                                             preferred_doc_id=preferred_doc_id)
    email = get_email_from_request()
    judge_id = DBProxy.get_judge_id(email)
    unpreferred_doc_id = request.form.get('unpreferred')
    time_started = int(request.form.get('time_started'))
    proxy_id = DBProxy.get_sorting_proxy_id(get_current_project())
    preferred_doc_name = DBProxy.get_doc_name(preferred_doc_id)
    unpreferred_doc_name = DBProxy.get_doc_name(unpreferred_doc_id)
    DBProxy.make_comparison(judge_id=judge_id,
                            preferred_doc_name=preferred_doc_name,
                            unpreferred_doc_name=unpreferred_doc_name,
                            duration=floor(time.time()) - time_started,
                            sorting_proxy_id=proxy_id,
                            used_in_sorting=pair_submitted,
                            project_name=get_current_project())
    if request.form.get('admin') == 'True':
        return redirect(url_for('tower'))
    if isinstance(request.form.get('another_pair_checkbox'), type(None)):
        # flash('Judgment submitted', 'success')
        return redirect(url_for('instructions'))
    else:
        return redirect(url_for('sorter'))
Пример #2
0
def hard_easy():
    email = get_email_from_request()
    project = get_current_project()
    doc1_id = request.form.get('file_one_id')
    doc2_id = request.form.get('file_two_id')
    pair_id = request.form.get('pair_id')
    DBProxy.add_doc_pair_reject(judge_id=DBProxy.get_judge_id(email),
                                email=email,
                                project_name=project,
                                doc1_id=doc1_id,
                                doc2_id=doc2_id,
                                doc_pair_id=pair_id)
    DBProxy.return_pair(pair_id, too_hard=True)
    return redirect(url_for('sorter'))