예제 #1
0
def judge(category_id):
    annotator = get_current_annotator()
    if annotator is None:
        return render_template('logged_out.html',
                               content=utils.render_markdown(
                                   settings.LOGGED_OUT_MESSAGE))
    else:
        annotator_category = annotator.get_category(category_id)
        if annotator_category is None:
            return utils.user_error('AnnotatorCategory %s not found ' %
                                    category_id)

        if not annotator_category.category.active:
            return render_template('closed.html',
                                   content=utils.render_markdown(
                                       settings.CLOSED_MESSAGE))

        maybe_init_annotator(annotator, annotator_category)
        if annotator_category.next is None:
            return render_template('wait.html',
                                   content=utils.render_markdown(
                                       settings.WAIT_MESSAGE))
        elif annotator_category.prev is None:
            return render_template('begin.html',
                                   item=annotator_category.next,
                                   category=annotator_category.category)
        else:
            return render_template('vote.html',
                                   prev=annotator_category.prev,
                                   next=annotator_category.next,
                                   category=annotator_category.category)
예제 #2
0
def index():
    annotator = get_current_annotator()
    if annotator is None:
        return render_template(
            'logged_out.html',
            content=utils.render_markdown(settings.LOGGED_OUT_MESSAGE)
        )
    else:
        if Setting.value_of(SETTING_CLOSED) == SETTING_TRUE:
            return render_template(
                'closed.html',
                content=utils.render_markdown(settings.CLOSED_MESSAGE)
            )
        if not annotator.active:
            return render_template(
                'disabled.html',
                content=utils.render_markdown(settings.DISABLED_MESSAGE)
            )
        if not annotator.read_welcome:
            return redirect(url_for('welcome'))
        maybe_init_annotator()
        if annotator.next is None:
            return render_template(
                'wait.html',
                content=utils.render_markdown(settings.WAIT_MESSAGE)
            )
        elif annotator.prev is None:
            return render_template('begin.html', item=annotator.next)
        else:
            return render_template('vote.html', prev=annotator.prev, next=annotator.next)
예제 #3
0
def index():
    annotator = get_current_annotator()
    if annotator is None:
        return render_template('logged_out.html',
                               content=utils.render_markdown(
                                   settings.LOGGED_OUT_MESSAGE))
    else:
        if Setting.value_of(SETTING_CLOSED) == SETTING_TRUE:
            return render_template('closed.html',
                                   content=utils.render_markdown(
                                       settings.CLOSED_MESSAGE))
        if not annotator.active:
            return render_template('disabled.html',
                                   content=utils.render_markdown(
                                       settings.DISABLED_MESSAGE))
        if not annotator.read_welcome:
            return redirect(url_for('welcome'))

        categories = [
            ac.category for ac in annotator.categories if ac.category.active
        ]
        if len(categories) == 1:
            return redirect(url_for('judge', category_id=categories[0].id))
        if len(categories) == 0:
            return render_template('closed.html',
                                   content=utils.render_markdown(
                                       settings.CLOSED_MESSAGE))

        return render_template('categories.html', categories=categories)
예제 #4
0
파일: judge.py 프로젝트: anishathalye/gavel
def index():
    annotator = get_current_annotator()
    if annotator is None:
        return render_template(
            'logged_out.html',
            content=utils.render_markdown(settings.LOGGED_OUT_MESSAGE)
        )
    else:
        if Setting.value_of(SETTING_CLOSED) == SETTING_TRUE:
            return render_template(
                'closed.html',
                content=utils.render_markdown(settings.CLOSED_MESSAGE)
            )
        if not annotator.active:
            return render_template(
                'disabled.html',
                content=utils.render_markdown(settings.DISABLED_MESSAGE)
            )
        if not annotator.read_welcome:
            return redirect(url_for('welcome'))
        maybe_init_annotator(annotator)
        if annotator.next is None:
            return render_template(
                'wait.html',
                content=utils.render_markdown(settings.WAIT_MESSAGE)
            )
        elif annotator.prev is None:
            return render_template('begin.html', item=annotator.next)
        else:
            return render_template('vote.html', prev=annotator.prev, next=annotator.next)
예제 #5
0
def index():
    annotator = get_current_annotator()
    if annotator is None:
        return render_template('logged_out.html',
                               content=utils.render_markdown(
                                   settings.LOGGED_OUT_MESSAGE))
    else:
        if Setting.value_of(SETTING_CLOSED) == SETTING_TRUE:
            return render_template('closed.html',
                                   content=utils.render_markdown(
                                       settings.CLOSED_MESSAGE))
        if not annotator.active:
            return render_template('disabled.html',
                                   content=utils.render_markdown(
                                       settings.DISABLED_MESSAGE))
        if not annotator.read_welcome:
            return redirect(url_for('welcome'))
        maybe_init_annotator(annotator)
        if annotator.next is None:
            return render_template('wait.html',
                                   content=utils.render_markdown(
                                       settings.WAIT_MESSAGE))
        elif annotator.prev is None:
            time = Setting.by_key("start_time").value
            return render_template('begin.html',
                                   start_time=time,
                                   item=annotator.next)
        else:
            query = Decision.query.filter_by(annotator_id=annotator.id)
            if query.count() > 0:
                time = max(Decision.query.filter_by(annotator_id=annotator.id),
                           key=lambda d: d.time).time
            else:
                time = Setting.by_key("start_time").value
            return render_template('vote.html',
                                   start_time=time,
                                   prev=annotator.prev,
                                   next=annotator.next)
예제 #6
0
def welcome():
    return render_template(
        'welcome.html',
        content=utils.render_markdown(settings.WELCOME_MESSAGE)
    )
예제 #7
0
파일: judge.py 프로젝트: anishathalye/gavel
def welcome():
    return render_template(
        'welcome.html',
        content=utils.render_markdown(settings.WELCOME_MESSAGE)
    )