master
Aevann1 2021-09-20 23:19:33 +02:00
parent a9cb97b482
commit d666bfaa95
2 changed files with 3 additions and 14 deletions

View File

@ -513,13 +513,3 @@ class SaveRelationship(Base):
user_id=Column(Integer, ForeignKey("users.id"))
submission_id=Column(Integer, ForeignKey("submissions.id"))
type=Column(Integer)
@property
@lazy
def created_date(self):
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))

View File

@ -559,9 +559,7 @@ class User(Base):
@lazy
def saved_idlist(self, page=1):
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False,
deleted_utc=0
)
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
saved = [x[0] for x in g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()]
posts = posts.filter(Submission.id.in_(saved))
@ -583,6 +581,7 @@ class User(Base):
return [x[0] for x in posts.offset(25 * (page - 1)).limit(26).all()]
@lazy
def saved_comment_idlist(self, page=1):
comments = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)