Commit 49fb261b authored by Ryan Herbert's avatar Ryan Herbert
Browse files

controllers/ refactor getStatHeaders

getStatHeaders now returns a list of pairs. the first element is the
header key, the second is a lambda function that will return the desired
value from the query result.
See #2235
parent 00ffd004
......@@ -652,7 +652,9 @@ def custom():
def getStatHeaders():
return ['set_name']
return [
('set_name', lambda x, y, z: z[y].get_name(x[y]))
def getStatData(results_file_ids):
mf = ModelFactory()
......@@ -678,13 +680,14 @@ def getStatData(results_file_ids):
for res in query:
d = {}
set_type = res.sample_set.sample_type
d['set_name'] = helpers[set_type].get_name(res[set_type])
for head, func in getStatHeaders():
d[head] = func(res, set_type, helpers)
return data
def multi_sample_stats():
data = {}
data['headers'] = getStatHeaders()
data['headers'] = [h for h, f in getStatHeaders()]
results = []
#if not auth.can_view_sample_set():
# return "permission denied %s" % res
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment