Order versions in descending order in CVE list
authorJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 28 Mar 2021 17:18:09 +0000 (13:18 -0400)
committerJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 28 Mar 2021 17:18:09 +0000 (13:18 -0400)
Across other parts of pgweb we display things from newest to
oldest version, so this brings the CVE display to match this
convention.

pgweb/security/views.py

index b36fcc047de04d89f3d7bb921f26176e257b5fe0..86f9ddd4a58eb1f6f8640634292bd4e2627b2b4a 100644 (file)
@@ -9,7 +9,7 @@ from .models import SecurityPatch, make_cvenumber
 
 
 def GetPatchesList(filt):
-    return SecurityPatch.objects.raw("SELECT p.*, array_agg(CASE WHEN v.tree >= 10 THEN v.tree::int ELSE v.tree END ORDER BY v.tree) AS affected, array_agg(CASE WHEN v.tree >= 10 THEN v.tree::int ELSE v.tree END || '.' || fixed_minor ORDER BY v.tree) AS fixed FROM security_securitypatch p INNER JOIN security_securitypatchversion sv ON p.id=sv.patch_id INNER JOIN core_version v ON v.id=sv.version_id WHERE p.public AND {0} GROUP BY p.id ORDER BY cvenumber DESC".format(filt))
+    return SecurityPatch.objects.raw("SELECT p.*, array_agg(CASE WHEN v.tree >= 10 THEN v.tree::int ELSE v.tree END ORDER BY v.tree DESC) AS affected, array_agg(CASE WHEN v.tree >= 10 THEN v.tree::int ELSE v.tree END || '.' || fixed_minor ORDER BY v.tree DESC) AS fixed FROM security_securitypatch p INNER JOIN security_securitypatchversion sv ON p.id=sv.patch_id INNER JOIN core_version v ON v.id=sv.version_id WHERE p.public AND {0} GROUP BY p.id ORDER BY cvenumber DESC".format(filt))
 
 
 def _list_patches(request, filt):