Browse Source

fix misc errors

David 9 years atrás
parent
commit
31af0ae156
2 changed files with 4 additions and 3 deletions
  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