Skip to content

Commit 928d3fb

Browse files
committed
Make search more efficient
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent cea3db7 commit 928d3fb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

vulnerabilities/templates/packages_v2.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
<span
4242
class="has-tooltip-multiline has-tooltip-black has-tooltip-arrow has-tooltip-text-left"
4343
data-tooltip="This is the number of vulnerabilities that affect the package.">
44-
Affected by vulnerabilities
44+
Vulnerable
4545
</span>
4646
</th>
4747
<th style="width: 225px;">
4848
<span
4949
class="has-tooltip-multiline has-tooltip-black has-tooltip-arrow has-tooltip-text-left"
5050
data-tooltip="This is the number of vulnerabilities fixed by the package.">
51-
Fixing vulnerabilities
51+
Risk Score
5252
</span>
5353
</th>
5454
</tr>
@@ -61,8 +61,8 @@
6161
href="{{ package.get_absolute_url }}?search={{ search }}"
6262
target="_self">{{ package.purl }}</a>
6363
</td>
64-
<td>{{ package.vulnerability_count }}</td>
65-
<td>{{ package.patched_vulnerability_count }}</td>
64+
<td>{{ package.is_vulnerable|yesno:"Yes,No" }}</td>
65+
<td>{{ package.risk_score }}</td>
6666
</tr>
6767
{% empty %}
6868
<tr>

vulnerabilities/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ def get_queryset(self, query=None):
100100
query = query or self.request.GET.get("search") or ""
101101
return (
102102
self.model.objects.search(query)
103-
.with_vulnerability_counts()
104103
.prefetch_related()
105104
.order_by("package_url")
105+
.with_is_vulnerable()
106106
)
107107

108108

0 commit comments

Comments
 (0)