diff options
Diffstat (limited to 'source/pyAggr3g470r.py')
-rwxr-xr-x | source/pyAggr3g470r.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 8b222f68..116689c9 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -44,6 +44,7 @@ __license__ = "GPLv3" import os import re +import time import datetime from collections import defaultdict @@ -443,11 +444,13 @@ class pyAggr3g470r(object): inactives = [] for feed in feeds: more_recent_article = self.mongo.get_articles(feed["feed_id"], limit=1) - if more_recent_article.count() != 0: + if more_recent_article.count() == 0: + last_post = datetime.datetime.fromtimestamp(time.mktime(time.gmtime(0))) + else: last_post = next(more_recent_article)["article_date"] - elapsed = today - last_post - if elapsed > datetime.timedelta(days=int(nb_days)): - inactives.append((feed, elapsed)) + elapsed = today - last_post + if elapsed > datetime.timedelta(days=int(nb_days)): + inactives.append((feed, elapsed)) tmpl = lookup.get_template("inactives.html") return tmpl.render(inactives=inactives, nb_days=int(nb_days)) |