Skip to content

Commit 9a5a26b

Browse files
committed
refine the queryset to include policy violation
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 10b9891 commit 9a5a26b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

product_portfolio/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def with_compliance_data(self):
219219
self.with_risk_threshold()
220220
.with_vulnerability_counts()
221221
.with_license_compliance_counts()
222+
.with_policy_violation_count()
222223
.annotate(package_count=Count("productpackages", distinct=True))
223224
.order_by(
224225
F("max_risk_score").desc(nulls_last=True),
@@ -230,12 +231,13 @@ def with_compliance_data(self):
230231
)
231232

232233
def with_compliance_issues(self):
233-
"""Filter to products that have license or critical/high vulnerability issues."""
234+
"""Filter to products that have license, vulnerability, or policy violation issues."""
234235
return self.filter(
235236
Q(license_error_count__gt=0)
236237
| Q(license_warning_count__gt=0)
237238
| Q(critical_count__gt=0)
238239
| Q(high_count__gt=0)
240+
| Q(policy_violation_count__gt=0)
239241
)
240242

241243
def with_has_vulnerable_packages(self):

product_portfolio/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3106,7 +3106,6 @@ def get_queryset(self):
31063106
get_viewable_products(self.request.user)
31073107
.with_compliance_data()
31083108
.with_has_vulnerable_packages()
3109-
.with_policy_violation_count()
31103109
)
31113110

31123111
def get_context_data(self, **kwargs):

0 commit comments

Comments
 (0)