Exemple #1
0
def attach_extra_info(queryset, user=None):
    # Userstories prefetching
    UserStory = apps.get_model("userstories", "UserStory")
    us_queryset = UserStory.objects.select_related("milestone",
                                                   "project",
                                                   "status",
                                                   "owner",
                                                   "assigned_to",
                                                   "generated_from_issue")

    us_queryset = userstories_utils.attach_total_points(us_queryset)
    us_queryset = userstories_utils.attach_role_points(us_queryset)
    us_queryset = attach_total_voters_to_queryset(us_queryset)
    us_queryset = attach_watchers_to_queryset(us_queryset)
    us_queryset = attach_total_watchers_to_queryset(us_queryset)
    us_queryset = attach_is_voter_to_queryset(us_queryset, user)
    us_queryset = attach_is_watcher_to_queryset(us_queryset, user)

    queryset = queryset.prefetch_related(Prefetch("user_stories", queryset=us_queryset))
    queryset = attach_total_points(queryset)
    queryset = attach_closed_points(queryset)

    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #2
0
def attach_extra_info(queryset, user=None):
    # Userstories prefetching
    UserStory = apps.get_model("userstories", "UserStory")
    us_queryset = UserStory.objects.select_related("milestone", "project",
                                                   "status", "owner",
                                                   "assigned_to",
                                                   "generated_from_issue",
                                                   "generated_from_task")

    us_queryset = userstories_utils.attach_total_points(us_queryset)
    us_queryset = userstories_utils.attach_total_attachments(us_queryset)
    us_queryset = userstories_utils.attach_role_points(us_queryset)
    us_queryset = userstories_utils.attach_epics(us_queryset)

    us_queryset = attach_total_voters_to_queryset(us_queryset)
    us_queryset = attach_watchers_to_queryset(us_queryset)
    us_queryset = attach_total_watchers_to_queryset(us_queryset)
    us_queryset = attach_is_voter_to_queryset(us_queryset, user)
    us_queryset = attach_is_watcher_to_queryset(us_queryset, user)

    queryset = queryset.prefetch_related(
        Prefetch("user_stories", queryset=us_queryset))

    queryset = attach_total_points(queryset)
    queryset = attach_closed_points(queryset)

    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)

    return queryset
Exemple #3
0
    def attach_watchers_attrs_to_queryset(self, queryset):
        qs = attach_watchers_to_queryset(queryset)
        qs = attach_total_watchers_to_queryset(queryset)
        if self.request.user.is_authenticated():
            qs = attach_is_watcher_to_queryset(qs, self.request.user)

        return qs
Exemple #4
0
def attach_extra_info(queryset,
                      user=None,
                      include_attachments=False,
                      include_tasks=False,
                      epic_id=None):
    queryset = attach_total_points(queryset)
    queryset = attach_role_points(queryset)
    queryset = attach_epics(queryset)

    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    if include_tasks:
        queryset = attach_tasks(queryset)
        queryset = queryset.extra(select={"include_tasks": "True"})

    if epic_id is not None:
        queryset = attach_epic_order(queryset, epic_id)
        queryset = queryset.extra(select={"include_epic_order": "True"})

    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    queryset = attach_total_comments_to_queryset(queryset)
    return queryset
Exemple #5
0
def attach_extra_info(queryset, user=None, include_attachments=False, include_tasks=False, epic_id=None):
    queryset = attach_total_points(queryset)
    queryset = attach_role_points(queryset)
    queryset = attach_epics(queryset)

    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    if include_tasks:
        queryset = attach_tasks(queryset)
        queryset = queryset.extra(select={"include_tasks": "True"})

    if epic_id is not None:
        queryset = attach_epic_order(queryset, epic_id)
        queryset = queryset.extra(select={"include_epic_order": "True"})

    queryset = attach_total_attachments(queryset)
    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    queryset = attach_total_comments_to_queryset(queryset)
    return queryset
Exemple #6
0
    def attach_watchers_attrs_to_queryset(self, queryset):
        qs = attach_watchers_to_queryset(queryset)
        qs = attach_total_watchers_to_queryset(queryset)
        if self.request.user.is_authenticated():
            qs = attach_is_watcher_to_queryset(qs, self.request.user)

        return qs
Exemple #7
0
def attach_extra_info(queryset, user=None):
    queryset = attach_generated_user_stories(queryset)
    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #8
0
def attach_extra_info(queryset, user=None):
    queryset = attach_generated_user_stories(queryset)
    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #9
0
def attach_extra_info(queryset, user=None, include_attachments=False):
    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    queryset = attach_generated_user_stories(queryset)
    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #10
0
def attach_extra_info(queryset, user=None, include_attachments=False):
    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    queryset = attach_user_stories_counts_to_queryset(queryset)
    queryset = attach_child_epics_counts_to_queryset(queryset)
    queryset = attach_epic_progress_to_queryset(queryset)
    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #11
0
def attach_extra_info(queryset, user=None, include_attachments=False, include_tasks=False):
    queryset = attach_total_points(queryset)
    queryset = attach_role_points(queryset)

    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    if include_tasks:
        queryset = attach_tasks(queryset)
        queryset = queryset.extra(select={"include_tasks": "True"})

    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #12
0
def attach_extra_info(queryset, user=None, include_attachments=False, include_tasks=False):
    queryset = attach_total_points(queryset)
    queryset = attach_role_points(queryset)

    if include_attachments:
        queryset = attach_basic_attachments(queryset)
        queryset = queryset.extra(select={"include_attachments": "True"})

    if include_tasks:
        queryset = attach_tasks(queryset)
        queryset = queryset.extra(select={"include_tasks": "True"})

    queryset = attach_total_voters_to_queryset(queryset)
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_voter_to_queryset(queryset, user)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #13
0
def attach_extra_info(queryset, user=None, include_attachments=False):
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset
Exemple #14
0
def attach_extra_info(queryset, user=None, include_attachments=False):
    queryset = attach_watchers_to_queryset(queryset)
    queryset = attach_total_watchers_to_queryset(queryset)
    queryset = attach_is_watcher_to_queryset(queryset, user)
    return queryset