@@ -1365,14 +1365,28 @@ def license_detections_count(self):
1365
1365
1366
1366
@cached_property
1367
1367
def package_compliance_alert_count (self ):
1368
- """Return the number of packages related to this project which have."""
1368
+ """
1369
+ Return the number of packages related to this project which have
1370
+ a license compliance error alert.
1371
+ """
1369
1372
return self .discoveredpackages .has_compliance_alert ().count ()
1370
1373
1371
1374
@cached_property
1372
1375
def license_compliance_alert_count (self ):
1373
- """Return the number of packages related to this project which have."""
1376
+ """
1377
+ Return the number of license detections related to this project
1378
+ which have a license compliance error alert.
1379
+ """
1374
1380
return self .discoveredlicenses .has_compliance_alert ().count ()
1375
1381
1382
+ @cached_property
1383
+ def resource_compliance_alert_count (self ):
1384
+ """
1385
+ Return the number of codebase resources related to this project which have
1386
+ a license compliance error alert.
1387
+ """
1388
+ return self .codebaseresources .has_compliance_alert ().count ()
1389
+
1376
1390
@cached_property
1377
1391
def message_count (self ):
1378
1392
"""Return the number of messages related to this project."""
@@ -2042,7 +2056,15 @@ def convert_glob_to_django_regex(glob_pattern):
2042
2056
return escaped_pattern
2043
2057
2044
2058
2045
- class CodebaseResourceQuerySet (ProjectRelatedQuerySet ):
2059
+ class ComplianceAlertQuerySetMixin :
2060
+ def has_compliance_alert (self ):
2061
+ return self .filter (Q (compliance_alert__exact = CodebaseResource .Compliance .ERROR ))
2062
+
2063
+
2064
+ class CodebaseResourceQuerySet (
2065
+ ComplianceAlertQuerySetMixin ,
2066
+ ProjectRelatedQuerySet ,
2067
+ ):
2046
2068
def prefetch_for_serializer (self ):
2047
2069
"""
2048
2070
Optimized prefetching for a QuerySet to be consumed by the
@@ -2945,11 +2967,6 @@ def vulnerable(self):
2945
2967
return self .filter (~ Q (affected_by_vulnerabilities__in = EMPTY_VALUES ))
2946
2968
2947
2969
2948
- class ComplianceAlertQuerySetMixin :
2949
- def has_compliance_alert (self ):
2950
- return self .filter (Q (compliance_alert__exact = CodebaseResource .Compliance .ERROR ))
2951
-
2952
-
2953
2970
class DiscoveredPackageQuerySet (
2954
2971
VulnerabilityQuerySetMixin ,
2955
2972
ComplianceAlertQuerySetMixin ,
0 commit comments