From 3b15af6d55e2c29d38dd08c71dbf89f11f788b90 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 26 Dec 2012 22:29:14 +0100 Subject: Simplification of the history code. --- source/pyAggr3g470r.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 3ab5e0ae..acf64137 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -441,15 +441,15 @@ class pyAggr3g470r(object): for article in self.mongo.get_articles(feed["feed_id"]): if query == "all": - timeline[str(article["article_date"]).split(' ')[0].split('-')[0]] += 1 + timeline[article["article_date"].strftime('%Y')] += 1 elif query[:4] == "year": - if str(article["article_date"]).split(' ')[0].split('-')[0] == the_year: - timeline[str(article["article_date"]).split(' ')[0].split('-')[1]] += 1 + if article["article_date"].strftime('%Y') == the_year: + timeline[article["article_date"].strftime('%m')] += 1 if "month" in query: - if str(article["article_date"]).split(' ')[0].split('-')[1] == the_month: + if article["article_date"].strftime('%m') == the_month: if article["article_readed"] == False: # not readed articles are in bold not_read_begin, not_read_end = "", "" @@ -488,7 +488,7 @@ class pyAggr3g470r(object): query_string = "year:" + the_year + "-month" if "month" not in query: html += '
' + \ - utils.tag_cloud([(elem, timeline[elem]) for elem in list(timeline.keys())], query_string) + '
' + utils.tag_cloud([(elem, timeline[elem]) for elem in timeline.keys()], query_string) + '' html += '

Search with a month+year picker

\n' html += '
\n\t\n\t\n
' html += '
' -- cgit