getFollowers()/getFollowing() should not return records where 'until' is not null, i.e. records that are no longer valid

This commit is contained in:
Klaus-Uwe Mitterer 2016-08-03 13:58:19 +02:00
parent 5c22b78347
commit 3ec4780385
2 changed files with 2 additions and 6 deletions

View file

@ -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]

View file

@ -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())))