New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reactivate natural sorting order of notification by severity #777
feat: reactivate natural sorting order of notification by severity #777
Conversation
…s by severity [Summary]: This commit reverts the sorting order of notifications (alerts and investigations) to follow a natural sorting order based on severity. Previously, the sorting method was sorted alphabetically [Changes Made]: - Modified/Added the SQL query responsible for sorting notifications by severity. - Utilized a formula for natural sorting order based on severity. [Context/Reasoning]: Natural sorting by severity provides a more intuitive and user-friendly display of notifications, ensuring that higher severity issues are prioritized appropriately.
"WHEN A.severity = 'CRITICAL' THEN 2 " + | ||
"WHEN A.severity = 'LIFE_THREATENING' THEN 3 " + | ||
"ELSE -1 END FROM alert_notification A WHERE A.alert_id = id LIMIT 1)") | ||
private Integer severityRank; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its kind of confusing adding this logic as sql. It would be cleaner to add the rank of the natural order to the QualityNotificationSeverity Enum and sort its value
@@ -74,7 +74,7 @@ private static Sort toDomainSort(final List<String> sorts, BaseRequestFieldMappe | |||
try { | |||
String[] sortParams = sort.split(","); | |||
orders.add(new Sort.Order(Sort.Direction.valueOf(sortParams[1].toUpperCase()), | |||
fieldMapper.mapRequestFieldName(sortParams[0]))); | |||
handleEnumColumns(fieldMapper.mapRequestFieldName(sortParams[0])))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the new supported field to QualityNotificationFieldMapper and remove the newly created method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments
This PR introduces a new feature: reactivate natural sorting order of notifications by severity
[Issue]:
[Summary]:
[Changes Made]:
[Context/Reasoning]: