From 3fdfc7d7e1a08760583d9e85cbbc407b8032fcbd Mon Sep 17 00:00:00 2001 From: Asgef Date: Mon, 10 Jun 2024 17:17:57 +0300 Subject: [PATCH] [#425] Fix filter for "issues" page --- contributors/views/filters.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/contributors/views/filters.py b/contributors/views/filters.py index f494ce31..c54ad203 100644 --- a/contributors/views/filters.py +++ b/contributors/views/filters.py @@ -67,18 +67,14 @@ class Meta: # noqa: WPS306 def get_good_first_issue(self, queryset, name, value): # noqa: WPS110 """Filter issues by label 'good_first_issue'.""" - good_first = ContributionLabel.objects.filter( - name='good first issue', - ).first() - all_open_issues = Contribution.objects.filter( - type='iss', info__state='open', - ) - if good_first is None: - queryset = all_open_issues.none() - elif value: - queryset = all_open_issues.filter( - labels__in=[good_first.id], - ) + if value: # Only apply filter if checkbox is checked + good_first = ContributionLabel.objects.filter( + name='good first issue', + ).first() + if good_first: + queryset = queryset.filter( + labels__in=[good_first.id], info__state='open', + ) return queryset