From 3ec478038506090624ba37b2b06c8a71707bf7c8 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Wed, 3 Aug 2016 13:58:19 +0200 Subject: [PATCH] getFollowers()/getFollowing() should not return records where 'until' is not null, i.e. records that are no longer valid --- dbtools/__init__.py | 4 ++-- filler.py | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/dbtools/__init__.py b/dbtools/__init__.py index a0df836..5087cb5 100644 --- a/dbtools/__init__.py +++ b/dbtools/__init__.py @@ -75,12 +75,12 @@ class dbObject: return setuptools.getDate(str(self.getNext()["%s(SUBSTR(timestamp,0,11))" % mode])) def getFollowers(db): - db.executeQuery("SELECT id FROM followers;") + db.executeQuery("SELECT id FROM followers WHERE `until` IS NOT NULL;") for i in db.getAll(): yield i[0] def getFollowing(db): - db.executeQuery("SELECT id FROM following;") + db.executeQuery("SELECT id FROM following WHERE `until` IS NOT NULL;") for i in db.getAll(): yield i[0] diff --git a/filler.py b/filler.py index da3342f..657301f 100755 --- a/filler.py +++ b/filler.py @@ -58,10 +58,6 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject()): gained = 0 lost = 0 - if len(new) == 0: - print("Something went wrong here. -.-") - return 0,0 - for follower in new: if follower not in current: db.executeQuery("INSERT INTO followers VALUES('%s', %i, NULL)" % (follower, int(time.time())))