Skip to content

Commit

Permalink
Automatically create reports when there are enough new results
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Jan 17, 2011
1 parent e052778 commit be59020
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions speedcenter/codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,19 @@ def addresult(request):
if 'max' in data: r.val_max = data['max']
r.save()

# Trigger Report creation when there are enough results
last_revs = Revision.objects.order_by('-date')[:2]
if len(last_revs) > 1:
current_results = rev.result_set.filter(
executable=exe).filter(environment=e)
last_results = last_revs[1].result_set.filter(
executable=exe).filter(environment=e)
# If there is are at least as many results as in the last revision,
# create new report
if len(current_results) >= len(last_results):
report, created = Report.objects.get_or_create(
executable=exe, environment=e, revision=rev
)
report.save()

return HttpResponse("Result data saved succesfully")

0 comments on commit be59020

Please sign in to comment.