lint services
This commit is contained in:
@@ -20,7 +20,7 @@ class ShoutsCache:
|
||||
stmt = (
|
||||
select(Shout)
|
||||
.options(selectinload(Shout.authors), selectinload(Shout.topics))
|
||||
.where(Shout.publishedAt != None)
|
||||
.where(bool(Shout.publishedAt))
|
||||
.order_by(desc("publishedAt"))
|
||||
.limit(ShoutsCache.limit)
|
||||
)
|
||||
@@ -62,7 +62,7 @@ class ShoutsCache:
|
||||
selectinload(Shout.topics),
|
||||
)
|
||||
.join(Reaction, Reaction.shout == Shout.slug)
|
||||
.where(and_(Shout.publishedAt != None, Reaction.deletedAt == None))
|
||||
.where(and_(bool(Shout.publishedAt), bool(Reaction.deletedAt)))
|
||||
.group_by(Shout.slug)
|
||||
.order_by(desc("reactionCreatedAt"))
|
||||
.limit(ShoutsCache.limit)
|
||||
@@ -89,7 +89,7 @@ class ShoutsCache:
|
||||
selectinload(Shout.reactions),
|
||||
)
|
||||
.join(Reaction)
|
||||
.where(and_(Shout.publishedAt != None, Reaction.deletedAt == None))
|
||||
.where(and_(bool(Shout.publishedAt), bool(Reaction.deletedAt)))
|
||||
.group_by(Shout.slug)
|
||||
.order_by(desc("reacted"))
|
||||
.limit(ShoutsCache.limit)
|
||||
@@ -113,7 +113,7 @@ class ShoutsCache:
|
||||
select(Shout, func.count(Reaction.id).label("reacted"))
|
||||
.options(selectinload(Shout.authors), selectinload(Shout.topics))
|
||||
.join(Reaction)
|
||||
.where(and_(Shout.createdAt > month_ago, Shout.publishedAt != None))
|
||||
.where(and_(Shout.createdAt > month_ago, bool(Reaction.deletedAt)))
|
||||
.group_by(Shout.slug)
|
||||
.order_by(desc("reacted"))
|
||||
.limit(ShoutsCache.limit)
|
||||
@@ -136,7 +136,7 @@ class ShoutsCache:
|
||||
select(Shout, func.sum(ViewedByDay.value).label("viewed"))
|
||||
.options(selectinload(Shout.authors), selectinload(Shout.topics))
|
||||
.join(ViewedByDay)
|
||||
.where(and_(ViewedByDay.day > month_ago, Shout.publishedAt != None))
|
||||
.where(and_(Shout.createdAt > month_ago, bool(Reaction.deletedAt)))
|
||||
.group_by(Shout.slug)
|
||||
.order_by(desc("viewed"))
|
||||
.limit(ShoutsCache.limit)
|
||||
|
Reference in New Issue
Block a user