]> git.donarmstrong.com Git - neurodebian.git/blobdiff - survey/makestats
Also for stats report which repo and which job number use our setup
[neurodebian.git] / survey / makestats
index 6dcd20ff2c08f80170adcc0d7e4feae52d10b2ec..c67a3ad72cca630a895c8eab704c6897ff551e20 100755 (executable)
@@ -161,13 +161,18 @@ class DB(dict):
                 missing += 1
         return val, missing
 
-    def get_counts(self, key):
+    def get_counts(self, key, predef_keys=None):
         # return a dict with field values as keys and respective submission 
         # count as value
         vals = self.get_not_none(key)[0]
         uniq = np.unique(vals)
         counts = dict(zip(uniq, [vals.count(u) for u in uniq]))
-        return counts
+        if not predef_keys is None:
+            ret = dict(zip(predef_keys, [0] * len(predef_keys)))
+        else:
+            ret = {}
+        ret.update(counts)
+        return ret
 
     def select_match(self, key, values):
         # return a db with all submissions were a field id has one of the