예제 #1
0
파일: reports.py 프로젝트: ysoffner/sentry
def fetch_personal_statistics(start__stop, organization, user):
    start, stop = start__stop
    resolved_issue_ids = set(
        Activity.objects.filter(
            project__organization_id=organization.id,
            user_id=user.id,
            type__in=(
                Activity.SET_RESOLVED,
                Activity.SET_RESOLVED_IN_RELEASE,
            ),
            datetime__gte=start,
            datetime__lt=stop,
            group__status=GroupStatus.
            RESOLVED,  # only count if the issue is still resolved
        ).distinct().values_list('group_id', flat=True))

    if resolved_issue_ids:
        users = tsdb.get_distinct_counts_union(
            tsdb.models.users_affected_by_group,
            resolved_issue_ids,
            start,
            stop,
            60 * 60 * 24,
        )
    else:
        users = {}

    return {
        'resolved': len(resolved_issue_ids),
        'users': users,
    }
예제 #2
0
파일: reports.py 프로젝트: Kayle009/sentry
def fetch_personal_statistics(start__stop, organization, user):
    start, stop = start__stop
    resolved_issue_ids = set(
        Activity.objects.filter(
            project__organization_id=organization.id,
            user_id=user.id,
            type__in=(Activity.SET_RESOLVED, Activity.SET_RESOLVED_IN_RELEASE, ),
            datetime__gte=start,
            datetime__lt=stop,
            group__status=GroupStatus.RESOLVED,  # only count if the issue is still resolved
        ).distinct().values_list(
            'group_id', flat=True
        )
    )

    if resolved_issue_ids:
        users = tsdb.get_distinct_counts_union(
            tsdb.models.users_affected_by_group,
            resolved_issue_ids,
            start,
            stop,
            60 * 60 * 24,
        )
    else:
        users = {}

    return {
        'resolved': len(resolved_issue_ids),
        'users': users,
    }
예제 #3
0
        project__organization_id=organization.id,
        user_id=user.id,
        type__in=(
            Activity.SET_RESOLVED,
            Activity.SET_RESOLVED_IN_RELEASE,
        ),
        datetime__gte=start,
        datetime__lt=stop,
        group__status=GroupStatus.RESOLVED,  # only count if the issue is still resolved
    ).distinct().values_list('group_id', flat=True)
    return {
        'resolved': len(resolved_issue_ids),
        'users': tsdb.get_distinct_counts_union(
            tsdb.models.users_affected_by_group,
            resolved_issue_ids,
            start,
            stop,
            60 * 60 * 24,
        ),
    }


Duration = namedtuple(
    'Duration', (
        'adjective',    # e.g. "daily" or "weekly",
        'noun',         # relative to today, e.g. "yesterday" or "this week"
        'date_format',  # date format used for large series x axis labeling
    ))

durations = {
    (60 * 60 * 24 * 7): Duration(
예제 #4
0
파일: reports.py 프로젝트: WhoTrades/sentry
        project__organization_id=organization.id,
        user_id=user.id,
        type__in=(
            Activity.SET_RESOLVED,
            Activity.SET_RESOLVED_IN_RELEASE,
        ),
        datetime__gte=start,
        datetime__lt=stop,
        group__status=GroupStatus.RESOLVED,  # only count if the issue is still resolved
    ).distinct().values_list('group_id', flat=True)
    return {
        'resolved': len(resolved_issue_ids),
        'users': tsdb.get_distinct_counts_union(
            tsdb.models.users_affected_by_group,
            resolved_issue_ids,
            start,
            stop,
            60 * 60 * 24,
        ),
    }


Duration = namedtuple(
    'Duration', (
        'adjective',  # e.g. "daily" or "weekly",
        'noun',       # relative to today, e.g. "yesterday" or "this week"
    ))

durations = {
    (60 * 60 * 24 * 7): Duration(
        'weekly',