Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Average results for each revision with the same platform/test/branch.

  • Loading branch information...
commit 32b578592a29116c6326b739e89150e5cf4467ad 1 parent b48f8f4
@markrcote authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 peptest/server/handlers.py
View
15 peptest/server/handlers.py
@@ -2,6 +2,7 @@
import datetime
import templeton.handlers
import web
+from collections import defaultdict
class DefaultConfigParser(ConfigParser.ConfigParser):
@@ -57,7 +58,11 @@ def GET(self):
if wheres:
query += ' where %s' % ' and '.join(wheres)
results = db.query(query, vars=vars)
- response = []
+
+ # average results for each revision
+ # all results are for just one test/platform/branch, so we can keep
+ # this simple
+ by_revision = defaultdict(list)
for r in results:
d = {}
for k, v in r.iteritems():
@@ -65,6 +70,14 @@ def GET(self):
d[k] = v.isoformat()
else:
d[k] = v
+ by_revision[d['revision']].append(d)
+
+ response = []
+ for results in by_revision.values():
+ # copy first element to preserve all the other metadata
+ d = results[0].copy()
+ d['metric'] = float(sum([x['metric'] for x in results])) / len(results)
+ d['pass'] = all([x['pass'] for x in results])
response.append(d)
return response
Please sign in to comment.
Something went wrong with that request. Please try again.