当前位置: 首页>>代码示例>>Python>>正文


Python utils.ReviewersQueuesHelper类代码示例

本文整理汇总了Python中mkt.reviewers.utils.ReviewersQueuesHelper的典型用法代码示例。如果您正苦于以下问题:Python ReviewersQueuesHelper类的具体用法?Python ReviewersQueuesHelper怎么用?Python ReviewersQueuesHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ReviewersQueuesHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: queue_escalated

def queue_escalated(request):
    queues_helper = ReviewersQueuesHelper(request)
    qs = queues_helper.get_escalated_queue()
    apps = queues_helper.sort(qs)
    apps = [QueuedApp(app, app.escalationqueue_set.all()[0].created)
            for app in apps]
    return _queue(request, apps, 'escalated')
开发者ID:miltonpereira,项目名称:zamboni,代码行数:7,代码来源:views.py

示例2: queue_apps

def queue_apps(request):
    queues_helper = ReviewersQueuesHelper(request)
    qs = queues_helper.get_pending_queue()
    apps = queues_helper.sort(qs, date_sort='nomination')
    apps = [QueuedApp(app, app.all_versions[0].nomination)
            for app in Webapp.version_and_file_transformer(apps)]
    return _queue(request, apps, 'pending', date_sort='nomination')
开发者ID:miltonpereira,项目名称:zamboni,代码行数:7,代码来源:views.py

示例3: queue_rereview

def queue_rereview(request):
    queues_helper = ReviewersQueuesHelper(request)
    qs = queues_helper.get_rereview_queue()
    apps = queues_helper.sort(qs)
    apps = [QueuedApp(app, app.rereviewqueue_set.all()[0].created)
            for app in apps]
    return _queue(request, apps, 'rereview')
开发者ID:miltonpereira,项目名称:zamboni,代码行数:7,代码来源:views.py

示例4: _progress

def _progress():
    """Returns unreviewed apps progress.

    Return the number of apps still unreviewed for a given period of time and
    the percentage.
    """

    queues_helper = ReviewersQueuesHelper()

    days_ago = lambda n: datetime.datetime.now() - datetime.timedelta(days=n)

    base_filters = {
        'pending': (queues_helper.get_pending_queue(),
                    'nomination'),
        'rereview': (queues_helper.get_rereview_queue(),
                     'created'),
        'escalated': (queues_helper.get_escalated_queue(),
                      'created'),
        'updates': (queues_helper.get_updates_queue(),
                    'nomination')
    }

    operators_and_values = {
        'new': ('gt', days_ago(5)),
        'med': ('range', (days_ago(10), days_ago(5))),
        'old': ('lt', days_ago(10)),
        'week': ('gte', days_ago(7))
    }

    types = base_filters.keys()
    progress = {}

    for t in types:
        tmp = {}
        base_query, field = base_filters[t]
        for k in operators_and_values.keys():
            operator, value = operators_and_values[k]
            filter_ = {}
            filter_['%s__%s' % (field, operator)] = value
            tmp[k] = base_query.filter(**filter_).count()
        progress[t] = tmp

    # Return the percent of (p)rogress out of (t)otal.
    pct = lambda p, t: (p / float(t)) * 100 if p > 0 else 0

    percentage = {}
    for t in types:
        total = progress[t]['new'] + progress[t]['med'] + progress[t]['old']
        percentage[t] = {}
        for duration in ('new', 'med', 'old'):
            percentage[t][duration] = pct(progress[t][duration], total)

    return (progress, percentage)
开发者ID:miltonpereira,项目名称:zamboni,代码行数:53,代码来源:views.py

示例5: queue_updates

def queue_updates(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')

    queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
    apps = queues_helper.get_updates_queue()
    apps = queues_helper.sort(apps, date_sort='nomination')

    if not use_es:
        apps = [QueuedApp(app, app.all_versions[0].nomination)
                for app in Webapp.version_and_file_transformer(apps)]

    return _queue(request, apps, 'updates', date_sort='nomination',
                  use_es=use_es)
开发者ID:clouserw,项目名称:zamboni,代码行数:13,代码来源:views.py

示例6: queue_escalated

def queue_escalated(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')

    queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
    apps = queues_helper.get_escalated_queue()
    apps = queues_helper.sort(apps, date_sort='created')

    if not use_es:
        apps = [QueuedApp(app, app.escalationqueue_set.all()[0].created)
                for app in apps]

    return _queue(request, apps, 'escalated', date_sort='created',
                  use_es=use_es)
开发者ID:clouserw,项目名称:zamboni,代码行数:13,代码来源:views.py

示例7: queue_counts

def queue_counts(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
    queues_helper = ReviewersQueuesHelper(use_es=use_es)

    counts = {
        'pending': queues_helper.get_pending_queue().count(),
        'rereview': queues_helper.get_rereview_queue().count(),
        'updates': queues_helper.get_updates_queue().count(),
        'escalated': queues_helper.get_escalated_queue().count(),
        'moderated': queues_helper.get_moderated_queue().count(),
        'abuse': queues_helper.get_abuse_queue().count(),
        'abusewebsites': queues_helper.get_abuse_queue_websites().count(),
        'region_cn': Webapp.objects.pending_in_region(mkt.regions.CHN).count(),
        'additional_tarako': (
            AdditionalReview.objects
                            .unreviewed(queue=QUEUE_TARAKO, and_approved=True)
                            .count()),
    }

    rv = {}
    if isinstance(type, basestring):
        return counts[type]
    for k, v in counts.items():
        if not isinstance(type, list) or k in type:
            rv[k] = v
    return rv
开发者ID:jamesthechamp,项目名称:zamboni,代码行数:26,代码来源:views.py

示例8: queue_rereview

def queue_rereview(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')

    queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
    apps = queues_helper.get_rereview_queue()
    apps = queues_helper.sort(apps, date_sort='created')

    if use_es:
        apps = [QueuedApp(app, app.rereview_date) for app in apps.execute()]
    else:
        apps = [QueuedApp(app, app.rereviewqueue_set.all()[0].created)
                for app in apps]

    return _queue(request, apps, 'rereview', date_sort='created',
                  use_es=use_es)
开发者ID:carriercomm,项目名称:zamboni,代码行数:15,代码来源:views.py

示例9: queue_apps

def queue_apps(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
    sort_field = 'nomination'

    queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
    qs = queues_helper.get_pending_queue()
    qs = queues_helper.sort(qs, date_sort=sort_field)

    if use_es:
        apps = qs
    else:
        apps = [QueuedApp(app, app.all_versions[0].nomination)
                for app in Webapp.version_and_file_transformer(qs)]

    return _queue(request, apps, 'pending', date_sort='nomination',
                  use_es=use_es)
开发者ID:JaredKerim-Mozilla,项目名称:zamboni,代码行数:16,代码来源:views.py

示例10: queue_abuse_websites

def queue_abuse_websites(request):
    """Queue for reviewing abuse reports for websites."""
    queues_helper = ReviewersQueuesHelper(request)
    sites = queues_helper.get_abuse_queue_websites()

    page = paginate(request, sites, per_page=20)
    abuse_formset = WebsiteAbuseViewFormSet(request.POST or None,
                                            queryset=page.object_list,
                                            request=request)

    if abuse_formset.is_valid():
        abuse_formset.save()
        return redirect(reverse('reviewers.websites.queue_abuse'))

    return render(request, 'reviewers/queue.html',
                  context(request, abuse_formset=abuse_formset,
                          tab='abusewebsites', page=page))
开发者ID:carriercomm,项目名称:zamboni,代码行数:17,代码来源:views.py

示例11: queue_homescreen

def queue_homescreen(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
    sort_field = 'nomination'

    queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
    apps = queues_helper.get_homescreen_queue()
    apps = queues_helper.sort(apps, date_sort=sort_field)

    if use_es:
        apps = [QueuedApp(app, app.latest_version.nomination_date)
                for app in apps.execute()]
    else:
        apps = [QueuedApp(app, app.all_versions[0].nomination)
                for app in Webapp.version_and_file_transformer(apps)]

    return _queue(request, apps, 'homescreen', date_sort='nomination',
                  use_es=use_es)
开发者ID:carriercomm,项目名称:zamboni,代码行数:17,代码来源:views.py

示例12: queue_moderated

def queue_moderated(request):
    """Queue for reviewing app reviews."""
    queues_helper = ReviewersQueuesHelper(request)
    qs = queues_helper.get_moderated_queue()

    page = paginate(request, qs, per_page=20)
    flags = dict(ReviewFlag.FLAGS)
    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse('reviewers.apps.queue_moderated'))

    return render(request, 'reviewers/queue.html',
                  context(request, reviews_formset=reviews_formset,
                          tab='moderated', page=page, flags=flags))
开发者ID:carriercomm,项目名称:zamboni,代码行数:18,代码来源:views.py

示例13: queue_region

def queue_region(request, region=None):
    # TODO: Create a landing page that lists all the special regions.
    if region is None:
        raise http.Http404

    region = parse_region(region)
    column = '_geodata__region_%s_nominated' % region.slug

    queues_helper = ReviewersQueuesHelper(request)
    qs = Webapp.objects.pending_in_region(region)
    apps = [ActionableQueuedApp(app, app.geodata.get_nominated_date(region),
                                reverse('approve-region',
                                        args=[app.id, region.slug]))
            for app in queues_helper.sort(qs, date_sort=column)]

    return _queue(request, apps, 'region', date_sort=column,
                  template='reviewers/queue_region.html',
                  data={'region': region})
开发者ID:carriercomm,项目名称:zamboni,代码行数:18,代码来源:views.py

示例14: queue_counts

def queue_counts(request):
    queues_helper = ReviewersQueuesHelper()

    counts = {
        'pending': queues_helper.get_pending_queue().count(),
        'rereview': queues_helper.get_rereview_queue().count(),
        'updates': queues_helper.get_updates_queue().count(),
        'escalated': queues_helper.get_escalated_queue().count(),
        'moderated': queues_helper.get_moderated_queue().count(),
        'region_cn': Webapp.objects.pending_in_region(mkt.regions.CN).count(),
        'additional_tarako': (
            AdditionalReview.objects
                            .unreviewed(queue=QUEUE_TARAKO, and_approved=True)
                            .count()),
    }

    if 'pro' in request.GET:
        counts.update({'device': device_queue_search(request).count()})

    rv = {}
    if isinstance(type, basestring):
        return counts[type]
    for k, v in counts.items():
        if not isinstance(type, list) or k in type:
            rv[k] = v
    return rv
开发者ID:miltonpereira,项目名称:zamboni,代码行数:26,代码来源:views.py

示例15: queue_counts

def queue_counts(request):
    use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
    queues_helper = ReviewersQueuesHelper(use_es=use_es)

    counts = {
        'pending': queues_helper.get_pending_queue().count(),
        'rereview': queues_helper.get_rereview_queue().count(),
        'updates': queues_helper.get_updates_queue().count(),
        'escalated': queues_helper.get_escalated_queue().count(),
        'moderated': queues_helper.get_moderated_queue().count(),
        'abuse': queues_helper.get_abuse_queue().count(),
        'abusewebsites': queues_helper.get_abuse_queue_websites().count(),
        'homescreen': queues_helper.get_homescreen_queue().count(),
    }

    rv = {}
    if isinstance(type, basestring):
        return counts[type]
    for k, v in counts.items():
        if not isinstance(type, list) or k in type:
            rv[k] = v
    return rv
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:22,代码来源:views.py


注:本文中的mkt.reviewers.utils.ReviewersQueuesHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。