mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-20 05:14:44 +00:00
Using wrong cut off for read story deletions.
This commit is contained in:
parent
719a88d3e0
commit
36b3fa92c1
1 changed files with 3 additions and 4 deletions
|
@ -881,7 +881,7 @@ class Feed(models.Model):
|
||||||
|
|
||||||
def trim_feed(self, verbose=False):
|
def trim_feed(self, verbose=False):
|
||||||
from apps.reader.models import MUserStory
|
from apps.reader.models import MUserStory
|
||||||
SUBSCRIBER_EXPIRE = datetime.datetime.now() - datetime.timedelta(days=settings.SUBSCRIBER_EXPIRE)
|
DAYS_OF_UNREAD = datetime.datetime.now() - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
|
||||||
trim_cutoff = 500
|
trim_cutoff = 500
|
||||||
if self.active_subscribers <= 1 and self.premium_subscribers < 1:
|
if self.active_subscribers <= 1 and self.premium_subscribers < 1:
|
||||||
trim_cutoff = 100
|
trim_cutoff = 100
|
||||||
|
@ -914,10 +914,9 @@ class Feed(models.Model):
|
||||||
|
|
||||||
# Can't use the story_trim_date because some users may have shared stories from
|
# Can't use the story_trim_date because some users may have shared stories from
|
||||||
# this feed, but the trim date isn't past the two weeks of unreads.
|
# this feed, but the trim date isn't past the two weeks of unreads.
|
||||||
userstories = MUserStory.objects(feed_id=self.pk, story_date__lte=SUBSCRIBER_EXPIRE)
|
userstories = MUserStory.objects(feed_id=self.pk, story_date__lte=DAYS_OF_UNREAD)
|
||||||
if userstories.count():
|
if userstories.count():
|
||||||
if verbose:
|
logging.debug(" ---> [%-30s] ~FBFound %s user stories. Deleting..." % (unicode(self)[:30], userstories.count()))
|
||||||
print "Found %s user stories. Deleting..." % userstories.count()
|
|
||||||
for userstory in userstories:
|
for userstory in userstories:
|
||||||
userstory.delete()
|
userstory.delete()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue