OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 ''' | 8 ''' |
9 | 9 |
10 ''' | 10 ''' |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 "builder": builder, | 198 "builder": builder, |
199 "test": test, | 199 "test": test, |
200 "config": config, | 200 "config": config, |
201 "resultType": updated_result_type, | 201 "resultType": updated_result_type, |
202 "actualHashType": actual_image[0], | 202 "actualHashType": actual_image[0], |
203 "actualHashDigest": str(actual_image[1]), | 203 "actualHashDigest": str(actual_image[1]), |
204 "expectedHashType": expected_image[0], | 204 "expectedHashType": expected_image[0], |
205 "expectedHashDigest": str(expected_image[1]), | 205 "expectedHashDigest": str(expected_image[1]), |
206 } | 206 } |
207 Results._AddToCategoryDict(category_dict, results_for_this_test) | 207 Results._AddToCategoryDict(category_dict, results_for_this_test) |
208 | 208 test_data.append(results_for_this_test) |
epoger
2013/10/01 21:16:10
Now that we limit the number of results shown, it'
| |
209 # TODO(epoger): For now, don't include succeeded results in the raw | |
210 # data. There are so many of them that they make the client too slow. | |
211 if updated_result_type != gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED: | |
212 test_data.append(results_for_this_test) | |
213 return {"categories": category_dict, "testData": test_data} | 209 return {"categories": category_dict, "testData": test_data} |
214 | 210 |
215 @staticmethod | 211 @staticmethod |
216 def _AddToCategoryDict(category_dict, test_results): | 212 def _AddToCategoryDict(category_dict, test_results): |
217 """Add test_results to the category dictionary we are building | 213 """Add test_results to the category dictionary we are building |
218 (see documentation of self.GetAll() for the format of this dictionary). | 214 (see documentation of self.GetAll() for the format of this dictionary). |
219 | 215 |
220 params: | 216 params: |
221 category_dict: category dict-of-dicts to add to; modify this in-place | 217 category_dict: category dict-of-dicts to add to; modify this in-place |
222 test_results: test data with which to update category_list, in a dict: | 218 test_results: test data with which to update category_list, in a dict: |
223 { | 219 { |
224 "category_name": "category_value", | 220 "category_name": "category_value", |
225 "category_name": "category_value", | 221 "category_name": "category_value", |
226 ... | 222 ... |
227 } | 223 } |
228 """ | 224 """ |
229 for category in CATEGORIES_TO_SUMMARIZE: | 225 for category in CATEGORIES_TO_SUMMARIZE: |
230 category_value = test_results.get(category) | 226 category_value = test_results.get(category) |
231 if not category_value: | 227 if not category_value: |
232 continue # test_results did not include this category, keep going | 228 continue # test_results did not include this category, keep going |
233 if not category_dict.get(category): | 229 if not category_dict.get(category): |
234 category_dict[category] = {} | 230 category_dict[category] = {} |
235 if not category_dict[category].get(category_value): | 231 if not category_dict[category].get(category_value): |
236 category_dict[category][category_value] = 0 | 232 category_dict[category][category_value] = 0 |
237 category_dict[category][category_value] += 1 | 233 category_dict[category][category_value] += 1 |
OLD | NEW |