From 93b6f17d081227f619cc22fb5ba6918937c8dd2e Mon Sep 17 00:00:00 2001
From: rabbitali <wenxin32@foxmail.com>
Date: Mon, 23 Oct 2023 11:16:47 +0800
Subject: [PATCH 1/1] fix the severity field filtering error

---
 apollo/conf/constant.py                                | 4 ++--
 apollo/database/proxy/cve.py                           | 2 +-
 apollo/handler/cve_handler/manager/parse_unaffected.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apollo/conf/constant.py b/apollo/conf/constant.py
index e2d91a6..878e86f 100644
--- a/apollo/conf/constant.py
+++ b/apollo/conf/constant.py
@@ -74,11 +74,11 @@ class CveSeverity:
     HIGH = "High"
     MEDIUM = "Medium"
     LOW = "Low"
-    NONE = "None"
+    UNKNOWN = "Unknown"
 
     @staticmethod
     def attribute():
-        return [CveSeverity.CRITICAL, CveSeverity.HIGH, CveSeverity.MEDIUM, CveSeverity.LOW, CveSeverity.NONE]
+        return [CveSeverity.CRITICAL, CveSeverity.HIGH, CveSeverity.MEDIUM, CveSeverity.LOW, CveSeverity.UNKNOWN]
 
 
 class TaskType:
diff --git a/apollo/database/proxy/cve.py b/apollo/database/proxy/cve.py
index 2b82cf6..f83784a 100644
--- a/apollo/database/proxy/cve.py
+++ b/apollo/database/proxy/cve.py
@@ -670,7 +670,7 @@ class CveProxy(CveMysqlProxy, CveEsProxy):
 
         # sort by host num by default
         sort_page["order_by_filed"] = data.get('sort', "host_num")
-        sort_page["order_by"] = "dsc" if data.get("direction") == "dsc" else "asc"
+        sort_page["order_by"] = data.get("direction", "asc")
         return sort_page
 
     def _query_cve_list(self, data):
diff --git a/apollo/handler/cve_handler/manager/parse_unaffected.py b/apollo/handler/cve_handler/manager/parse_unaffected.py
index b680123..e9eed57 100644
--- a/apollo/handler/cve_handler/manager/parse_unaffected.py
+++ b/apollo/handler/cve_handler/manager/parse_unaffected.py
@@ -137,5 +137,5 @@ def parse_cve_severity(cve_score: str) -> str:
     elif cvss_score > CvssScore.NONE:
         severity = CveSeverity.LOW
     else:
-        severity = CveSeverity.NONE
+        severity = CveSeverity.UNKNOWN
     return severity
-- 
2.33.0

