getFollowers()/getFollowing() should not return records where 'until' is not null, i.e. records that are no longer valid
This commit is contained in:
parent
5a99261b46
commit
403b5cadef
2 changed files with 2 additions and 6 deletions
|
@ -75,12 +75,12 @@ class dbObject:
|
||||||
return setuptools.getDate(str(self.getNext()["%s(SUBSTR(timestamp,0,11))" % mode]))
|
return setuptools.getDate(str(self.getNext()["%s(SUBSTR(timestamp,0,11))" % mode]))
|
||||||
|
|
||||||
def getFollowers(db):
|
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():
|
for i in db.getAll():
|
||||||
yield i[0]
|
yield i[0]
|
||||||
|
|
||||||
def getFollowing(db):
|
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():
|
for i in db.getAll():
|
||||||
yield i[0]
|
yield i[0]
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,6 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject()):
|
||||||
gained = 0
|
gained = 0
|
||||||
lost = 0
|
lost = 0
|
||||||
|
|
||||||
if len(new) == 0:
|
|
||||||
print("Something went wrong here. -.-")
|
|
||||||
return 0,0
|
|
||||||
|
|
||||||
for follower in new:
|
for follower in new:
|
||||||
if follower not in current:
|
if follower not in current:
|
||||||
db.executeQuery("INSERT INTO followers VALUES('%s', %i, NULL)" % (follower, int(time.time())))
|
db.executeQuery("INSERT INTO followers VALUES('%s', %i, NULL)" % (follower, int(time.time())))
|
||||||
|
|
Loading…
Reference in a new issue