|
72 | 72 | from .thrift_enum_helper import detection_status_enum, \
|
73 | 73 | detection_status_str, report_status_enum, \
|
74 | 74 | review_status_enum, review_status_str, report_extended_data_type_enum
|
| 75 | +from .report_annotations import report_annotation_types |
75 | 76 |
|
76 | 77 | # These names are inherited from Thrift stubs.
|
77 | 78 | # pylint: disable=invalid-name
|
@@ -1024,7 +1025,9 @@ def get_sort_map(sort_types, is_unique=False):
|
1024 | 1025 | SortType.REVIEW_STATUS: [(Report.review_status, 'rw_status')],
|
1025 | 1026 | SortType.DETECTION_STATUS: [(Report.detection_status, 'dt_status')],
|
1026 | 1027 | SortType.TIMESTAMP: [('annotation_timestamp', 'annotation_timestamp')],
|
1027 |
| - SortType.TESTCASE: [('annotation_testcase', 'annotation_testcase')]} |
| 1028 | + SortType.TESTCASE: [('annotation_testcase', 'annotation_testcase')], |
| 1029 | + SortType.CHRONOLOGICAL_ORDER: [('annotation_chronological_order', |
| 1030 | + 'annotation_chronological_order')]} |
1028 | 1031 |
|
1029 | 1032 | if is_unique:
|
1030 | 1033 | sort_type_map[SortType.FILENAME] = [(File.filename, 'filename')]
|
@@ -1959,7 +1962,9 @@ def getRunResults(self, run_ids, limit, offset, sort_types,
|
1959 | 1962 | for col in annotation_keys:
|
1960 | 1963 | annotation_cols[col] = func.max(sqlalchemy.case([(
|
1961 | 1964 | ReportAnnotations.key == col,
|
1962 |
| - ReportAnnotations.value)])).label(f"annotation_{col}") |
| 1965 | + cast(ReportAnnotations.value, |
| 1966 | + report_annotation_types[col]["db"]))])) \ |
| 1967 | + .label(f"annotation_{col}") |
1963 | 1968 |
|
1964 | 1969 | if report_filter.isUnique:
|
1965 | 1970 | # A report annotation filter cannot be set in WHERE clause if
|
@@ -2143,7 +2148,7 @@ def getRunResults(self, run_ids, limit, offset, sort_types,
|
2143 | 2148 | for row in query_result:
|
2144 | 2149 | report, filepath = row[0], row[1]
|
2145 | 2150 | annotations = {
|
2146 |
| - k: v for k, v in zip(annotation_keys, row[2:]) |
| 2151 | + k: str(v) for k, v in zip(annotation_keys, row[2:]) |
2147 | 2152 | if v is not None}
|
2148 | 2153 |
|
2149 | 2154 | review_data = create_review_data(
|
|
0 commit comments