Skip to content

Commit d7de361

Browse files
committed
remove n+1 query
1 parent 9400c37 commit d7de361

File tree

1 file changed

+6
-2
lines changed
  • backend/apps/github/api/internal/nodes

1 file changed

+6
-2
lines changed

backend/apps/github/api/internal/nodes/issue.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from apps.github.api.internal.nodes.pull_request import PullRequestNode
77
from apps.github.api.internal.nodes.user import UserNode
88
from apps.github.models.issue import Issue
9-
from apps.mentorship.models import IssueUserInterest # add import
109

1110

1211
@strawberry_django.type(
@@ -55,7 +54,12 @@ def labels(self) -> list[str]:
5554
@strawberry.field
5655
def interested_users(self) -> list[UserNode]:
5756
"""Return all users who have expressed interest in this issue."""
58-
return [interest.user for interest in IssueUserInterest.objects.filter(issue=self)]
57+
return [
58+
interest.user
59+
for interest in self.participant_interests.select_related("user").order_by(
60+
"user__login"
61+
)
62+
]
5963

6064
@strawberry.field
6165
def pull_requests(self) -> list[PullRequestNode]:

0 commit comments

Comments
 (0)