aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py19
-rw-r--r--source/templates/inactives.html13
2 files changed, 32 insertions, 0 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index 72320dc4..afd30f72 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -758,6 +758,25 @@ class pyAggr3g470r(object):
favorites.exposed = True
@require()
+ def inactives(self, nb_days=365):
+ """
+ List of favorites articles
+ """
+ feeds = self.mongo.get_all_feeds()
+ today = datetime.datetime.now()
+ inactives = []
+ for feed in feeds:
+ more_recent_article = self.mongo.get_articles(feed["feed_id"], limit=1)
+ last_post = next(more_recent_article)["article_date"]
+ 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))
+
+ inactives.exposed = True
+
+ @require()
def add_feed(self, url):
"""
Add a new feed with the URL of a page.
diff --git a/source/templates/inactives.html b/source/templates/inactives.html
new file mode 100644
index 00000000..10a79e8e
--- /dev/null
+++ b/source/templates/inactives.html
@@ -0,0 +1,13 @@
+## inactives.html
+<%inherit file="base.html"/>
+<div class="left inner">
+ %if inactives != []:
+ <h1>Feeds with no recent articles since ${nb_days} days:</h1>
+ <ul>
+ %for item in inactives:
+ <li><a href="/feed/${item[0]["feed_id"]}">${item[0]["feed_title"]}</a> (${item[1].days} days)</li>
+ %endfor
+ </ul>
+ %else:
+ <p>No inactive feeds.<p>
+ %endif \ No newline at end of file
bgstack15