OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import collections | 5 import collections |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from google.appengine.api import taskqueue | 9 from google.appengine.api import taskqueue |
10 from google.appengine.ext import ndb | 10 from google.appengine.ext import ndb |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 result_values = [] | 263 result_values = [] |
264 for change in self._changes: | 264 for change in self._changes: |
265 change_result_values = [] | 265 change_result_values = [] |
266 | 266 |
267 change_results_per_quest = _CombineResultsPerQuest(self._attempts[change]) | 267 change_results_per_quest = _CombineResultsPerQuest(self._attempts[change]) |
268 for quest in self._quests: | 268 for quest in self._quests: |
269 change_result_values.append(change_results_per_quest[quest]) | 269 change_result_values.append(change_results_per_quest[quest]) |
270 | 270 |
271 result_values.append(change_result_values) | 271 result_values.append(change_result_values) |
272 | 272 |
| 273 attempts = [] |
| 274 for c in self._changes: |
| 275 attempts.append([a.AsDict() for a in self._attempts[c]]) |
| 276 |
273 return { | 277 return { |
274 'quests': map(str, self._quests), | 278 'quests': map(str, self._quests), |
275 'changes': [change.AsDict() for change in self._changes], | 279 'changes': [change.AsDict() for change in self._changes], |
276 'comparisons': comparisons, | 280 'comparisons': comparisons, |
277 'result_values': result_values, | 281 'result_values': result_values, |
| 282 'attempts': attempts, |
278 } | 283 } |
279 | 284 |
280 def _Compare(self, change_a, change_b): | 285 def _Compare(self, change_a, change_b): |
281 attempts_a = self._attempts[change_a] | 286 attempts_a = self._attempts[change_a] |
282 attempts_b = self._attempts[change_b] | 287 attempts_b = self._attempts[change_b] |
283 | 288 |
284 if any(not attempt.completed for attempt in attempts_a + attempts_b): | 289 if any(not attempt.completed for attempt in attempts_a + attempts_b): |
285 return _PENDING | 290 return _PENDING |
286 | 291 |
287 results_a = _CombineResultsPerQuest(attempts_a) | 292 results_a = _CombineResultsPerQuest(attempts_a) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 324 |
320 try: | 325 try: |
321 p_value = mann_whitney_u.MannWhitneyU(results_a, results_b) | 326 p_value = mann_whitney_u.MannWhitneyU(results_a, results_b) |
322 except ValueError: | 327 except ValueError: |
323 return _UNKNOWN | 328 return _UNKNOWN |
324 | 329 |
325 if p_value < _SIGNIFICANCE_LEVEL: | 330 if p_value < _SIGNIFICANCE_LEVEL: |
326 return _DIFFERENT | 331 return _DIFFERENT |
327 else: | 332 else: |
328 return _UNKNOWN | 333 return _UNKNOWN |
OLD | NEW |