def queue_auto_approved(request): qs = ( AutoApprovalSummary.get_auto_approved_queue() .select_related( 'addonapprovalscounter', '_current_version__autoapprovalsummary') .order_by( '-_current_version__autoapprovalsummary__weight', 'addonapprovalscounter__last_human_review', 'created')) return _queue(request, AutoApprovedTable, 'auto_approved', qs=qs, SearchForm=None)
def queue_auto_approved(request): qs = (AutoApprovalSummary.get_auto_approved_queue().select_related( 'addonapprovalscounter', '_current_version__autoapprovalsummary').order_by( '-_current_version__autoapprovalsummary__weight', 'addonapprovalscounter__last_human_review', 'created')) return _queue(request, AutoApprovedTable, 'auto_approved', qs=qs, SearchForm=None)
def queue_counts(type=None, unlisted=False, admin_reviewer=False, limited_reviewer=False, **kw): def construct_query(query_type, days_min=None, days_max=None): query = query_type.objects if not admin_reviewer: query = exclude_admin_only_addons(query) if days_min: query = query.having('waiting_time_days >=', days_min) if days_max: query = query.having('waiting_time_days <=', days_max) if limited_reviewer: query = query.having('waiting_time_hours >=', amo.REVIEW_LIMITED_DELAY_HOURS) return query.count counts = { 'pending': construct_query(ViewPendingQueue, **kw), 'nominated': construct_query(ViewFullReviewQueue, **kw), 'moderated': Review.objects.all().to_moderate().count, 'auto_approved': (AutoApprovalSummary.get_auto_approved_queue().count), 'content_review': (AutoApprovalSummary.get_content_review_queue().count), } if unlisted: counts = { 'all': (ViewUnlistedAllList.objects if admin_reviewer else exclude_admin_only_addons(ViewUnlistedAllList.objects)).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
def queue_counts(type=None, unlisted=False, admin_reviewer=False, limited_reviewer=False, **kw): def construct_query(query_type, days_min=None, days_max=None): query = query_type.objects if not admin_reviewer: query = exclude_admin_only_addons(query) if days_min: query = query.having('waiting_time_days >=', days_min) if days_max: query = query.having('waiting_time_days <=', days_max) if limited_reviewer: query = query.having('waiting_time_hours >=', REVIEW_LIMITED_DELAY_HOURS) return query.count counts = { 'pending': construct_query(ViewPendingQueue, **kw), 'nominated': construct_query(ViewFullReviewQueue, **kw), 'moderated': Review.objects.all().to_moderate().count, 'auto_approved': ( AutoApprovalSummary.get_auto_approved_queue().count), } if unlisted: counts = { 'all': (ViewUnlistedAllList.objects if admin_reviewer else exclude_admin_only_addons( ViewUnlistedAllList.objects)).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