From bb5a7e24baf072af366b013240cc9d63f997153c Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 28 Mar 2015 14:16:45 +0100 Subject: Pairs of duplicates are sorted by retrieved date. --- pyaggr3g470r/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyaggr3g470r/utils.py b/pyaggr3g470r/utils.py index a7f8ad64..d1e4759b 100755 --- a/pyaggr3g470r/utils.py +++ b/pyaggr3g470r/utils.py @@ -312,7 +312,10 @@ def compare_documents(feed): date1, date2 = pair[0].date, pair[1].date if clear_string(pair[0].title) == clear_string(pair[1].title) and \ (date1 - date2) < timedelta(days = 1): - duplicates.append(pair) + if pair[0].retrieved_date < pair[1].retrieved_date: + duplicates.append((pair[0], pair[1])) + else: + duplicates.append(((pair[1], pair[0])) return duplicates def search_feed(url): -- cgit