Get the result for the crash stats page.
()
| 138 | |
| 139 | |
| 140 | def get_result(): |
| 141 | """Get the result for the crash stats page.""" |
| 142 | params = dict(request.iterparams()) |
| 143 | params['type'] = params.get('type', 'regression') |
| 144 | page = helpers.cast(request.get('page') or 1, int, "'page' is not an int.") |
| 145 | |
| 146 | is_revision_empty = 'revision' not in params |
| 147 | |
| 148 | query = big_query_query.Query() |
| 149 | crash_access.add_scope(query, params, 'security_flag', 'job_type', |
| 150 | 'fuzzer_name') |
| 151 | |
| 152 | if is_revision_empty: |
| 153 | total_count = 0 |
| 154 | rows = [] |
| 155 | else: |
| 156 | filters.add(query, params, FILTERS) |
| 157 | rows, total_count = get( |
| 158 | params=params, |
| 159 | query=query, |
| 160 | offset=(page - 1) * PAGE_SIZE, |
| 161 | limit=PAGE_SIZE) |
| 162 | helpers.log('Regression', helpers.VIEW_OPERATION) |
| 163 | |
| 164 | result = { |
| 165 | 'totalPages': (total_count // PAGE_SIZE) + 1, |
| 166 | 'page': page, |
| 167 | 'pageSize': PAGE_SIZE, |
| 168 | 'items': rows, |
| 169 | 'totalCount': total_count, |
| 170 | 'isRevisionEmpty': is_revision_empty |
| 171 | } |
| 172 | return result, params |
| 173 | |
| 174 | |
| 175 | class Handler(base_handler.Handler): |