Beispiel #1
0
    def get_queryset(self):
        qs = super().get_queryset()

        # Userstories prefetching
        UserStory = apps.get_model("userstories", "UserStory")

        us_qs = UserStory.objects.select_related("milestone",
                                                 "project",
                                                 "status",
                                                 "owner",
                                                 "assigned_to",
                                                 "generated_from_issue")

        us_qs = userstories_utils.attach_total_points(us_qs)
        us_qs = userstories_utils.attach_role_points(us_qs)
        us_qs = attach_total_voters_to_queryset(us_qs)
        us_qs = self.attach_watchers_attrs_to_queryset(us_qs)

        if self.request.user.is_authenticated():
            us_qs = attach_is_voter_to_queryset(self.request.user, us_qs)
            us_qs = attach_is_watcher_to_queryset(us_qs, self.request.user)

        qs = qs.prefetch_related(Prefetch("user_stories", queryset=us_qs))

        # Milestones prefetching
        qs = qs.select_related("project", "owner")
        qs = self.attach_watchers_attrs_to_queryset(qs)
        qs = milestones_utils.attach_total_points(qs)
        qs = milestones_utils.attach_closed_points(qs)
        qs = qs.order_by("-estimated_start")
        return qs
Beispiel #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")

    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
Beispiel #3
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
Beispiel #4
0
 def get_queryset(self):
     qs = super().get_queryset()
     qs = qs.select_related("milestone", "project", "status", "owner",
                            "assigned_to", "generated_from_issue")
     qs = self.attach_votes_attrs_to_queryset(qs)
     qs = self.attach_watchers_attrs_to_queryset(qs)
     qs = attach_total_points(qs)
     qs = attach_role_points(qs)
     return qs
Beispiel #5
0
 def get_queryset(self):
     qs = super().get_queryset()
     qs = qs.select_related("milestone",
                            "project",
                            "status",
                            "owner",
                            "assigned_to",
                            "generated_from_issue")
     qs = self.attach_votes_attrs_to_queryset(qs)
     qs = self.attach_watchers_attrs_to_queryset(qs)
     qs = attach_total_points(qs)
     qs = attach_role_points(qs)
     return qs
Beispiel #6
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")

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

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

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

    return queryset
Beispiel #7
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")

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

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

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

    return queryset
Beispiel #8
0
    def get_queryset(self):
        qs = super().get_queryset()
        qs = qs.select_related("milestone", "project", "status", "owner",
                               "assigned_to", "generated_from_issue")

        qs = self.attach_votes_attrs_to_queryset(qs)
        qs = self.attach_watchers_attrs_to_queryset(qs)
        qs = attach_total_points(qs)
        qs = attach_role_points(qs)

        if "include_attachments" in self.request.QUERY_PARAMS:
            qs = attach_basic_attachments(qs)
            qs = qs.extra(select={"include_attachments": "True"})

        if "include_tasks" in self.request.QUERY_PARAMS:
            qs = attach_tasks(qs)
            qs = qs.extra(select={"include_tasks": "True"})

        return qs
Beispiel #9
0
    def get_queryset(self):
        qs = super().get_queryset()
        qs = qs.select_related("milestone",
                               "project",
                               "status",
                               "owner",
                               "assigned_to",
                               "generated_from_issue")

        qs = self.attach_votes_attrs_to_queryset(qs)
        qs = self.attach_watchers_attrs_to_queryset(qs)
        qs = attach_total_points(qs)
        qs = attach_role_points(qs)

        if "include_attachments" in self.request.QUERY_PARAMS:
            qs = attach_basic_attachments(qs)
            qs = qs.extra(select={"include_attachments": "True"})

        if "include_tasks" in self.request.QUERY_PARAMS:
            qs = attach_tasks(qs)
            qs = qs.extra(select={"include_tasks": "True"})

        return qs