Commits

Ronny Pfannschmidt committed 8efd482

fix views

  • Participants
  • Parent commits c8d2b47

Comments (0)

Files changed (1)

File glas_process/ddoc.py

 views = {
     'streams': {
         'map': """(doc) ->
+                log 'map streams', doc._id
                 if doc.doc_type == "juggler:Task"
-                    emit [doc._id] null;
+                    emit [doc._id], null;
                 if doc.stream
                     emit [doc.task, doc.step], doc.stream
                 return
         """,
         'reduce': """(key, values, rereduce) ->
+                log ['reduce streams', values, rereduce]
                 if rereduce
                     items = [];
                     while values.length
                         items = items.concat values.pop()
                 else
                     items = values
-
+                log ['items', items]
                 unique = {};
                 while items.length
-                    entry = items.pop
+                    entry = items.pop()
                     if entry != null
                         unique[entry] = true;
 
-                result = [];
+                result = []
                 for key in unique
                     result.push(key);
                 return result
     'lists': makeviews(lists),
     'rewrites': rewrites,
 }
+
+if __name__ == '__main__':
+    import argparse
+    parser = argparse.ArgumentParser()
+    parser.add_argument('name')
+    parser.add_argument('path', nargs='...')
+    opts = parser.parse_args()
+    showone(opts.name, *opts.path)