Fine tune logic for sorting by severity

Problem to solve

On the project dependency list, vulnerability severities are sorted. The logic of the sort is shown in the following examples:

Example 1 - Sort by critical severity vulnerabilities first

  1. 10 critical, 5 high, and X other
  2. 5 critical, 10 high, and X other

Example 2 - Even though there are more high severity vulnerabilities, still sort by critical severity vulnerabilities first

  1. 1 critical, 5 high, and X other
  2. 0 critical, 20 high, and X other

Example 3 - If there are no critical vulnerabilities, sort by high severity vulnerabilities next

  1. 0 critical, 25 high, and X other
  2. 0 critical, 20 high, and X other

Example 4 - Even though there are more vulnerabilities with severities that are less severe than high, still sort by high severity first

  1. 0 critical, 25 high, and 25 other
  2. 0 critical, 0 high, and 30 other

Example 5 - If there are no critical and high severity vulnerabilities, look at the count for the remaining vulnerabilities.

  1. 0 critical, 0 high, and 15 other
  2. 0 critical, 0 high, and 2 other

All of the logic is great except: Example 6

  1. 1 critical, 0 high, and x other
  2. 1 critical, 1 high, and x other

The sort order for Example 6 should be:

  1. 1 critical, 1 high, and x other
  2. 1 critical, 0 high, and x other

for ascending sort by severity.

Edited by Alana Bellucci