Closed synfinner closed 2 months ago
When sorting vulnerabilities by days, it is not sticking to the sort order of newest to oldest.
This is caused by introduction of:
greenlets.append(spawn(self.query_database, field, cutoff_date, page, per_page))
We should be sending:
greenlets.append(spawn(self.query_database, field, cutoff_date, page, per_page, sort_order=-1))
And refactor the query database function to:
def query_database(self, field, cutoff_date, page, per_page, sort_order=1): """Query the database for recent vulnerabilities with pagination.""" skip = (page - 1) * per_page # Calculate how many documents to skip recent_vulnerabilities = all_vulns_collection.find( {field: {"$gt": cutoff_date}} ).sort(field, sort_order).skip(skip).limit(per_page) # Apply sorting and pagination
This was the sort is being sent and respected.
Merged commit that fixes this issue
When sorting vulnerabilities by days, it is not sticking to the sort order of newest to oldest.
This is caused by introduction of:
We should be sending:
And refactor the query database function to:
This was the sort is being sent and respected.