Skip to content

Commit

Permalink
Bug 1329992 - Fix resultset status endpoint (#2079)
Browse files Browse the repository at this point in the history
The way we were using Django's "annotate" function with values_list
resulted in non-deterministic output.
  • Loading branch information
wlach committed Jan 11, 2017
1 parent 1ef2306 commit 624132c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions treeherder/model/models.py
Expand Up @@ -141,9 +141,9 @@ def get_status(self, exclusion_profile="default"):
total_num_coalesced = 0
for (state, result, total, num_coalesced) in jobs.values_list(
'state', 'result').annotate(
total=Count('result'),
num_coalesced=Count(Case(When(
coalesced_to_guid__isnull=False, then=1)))):
total=Count('result')).annotate(
num_coalesced=Count(Case(When(
coalesced_to_guid__isnull=False, then=1)))):
total_num_coalesced += num_coalesced
if state == 'completed':
status_dict[result] = total - num_coalesced
Expand Down

0 comments on commit 624132c

Please sign in to comment.