Explorar el Código

fix misc errors

David hace 9 años
padre
commit
31af0ae156
Se han modificado 2 ficheros con 4 adiciones y 3 borrados
  1. 1 1
      analytics.py
  2. 3 2
      db.py

+ 1 - 1
analytics.py

@@ -25,4 +25,4 @@ if __name__ == '__main__':
     from db import db
     errors = db().get_sources_with_error()
     for e in errors:
-        post_data('error', {'source': e['_id']}, e['count'])
+        post_data('error', {'source': '"%s"' % e['_id']}, e['count'])

+ 3 - 2
db.py

@@ -186,5 +186,6 @@ class db():
             #matches, kw, weight
 
     def get_sources_with_error(self):
-        self.c_articles.aggregate([{'$match': {'error': True}},
-                                   {'$group': {'_id': '$source_name', 'count': {'$sum': 1}}}])
+        r = self.c_articles.aggregate([{'$match': {'error': True}},
+                                       {'$group': {'_id': '$source_name', 'count': {'$sum': 1}}}])
+        return r