This commit is contained in:
@@ -170,12 +170,12 @@ async def load_author_with_stats(q):
|
||||
)
|
||||
likes_count = (
|
||||
session.query(AuthorRating)
|
||||
.filter(and_(AuthorRating.author == author.id, AuthorRating.plus == True))
|
||||
.filter(and_(AuthorRating.author == author.id, AuthorRating.plus.is_(True)))
|
||||
.count()
|
||||
)
|
||||
dislikes_count = (
|
||||
session.query(AuthorRating)
|
||||
.filter(and_(AuthorRating.author == author.id, AuthorRating.plus != True))
|
||||
.filter(and_(AuthorRating.author == author.id, AuthorRating.plus.is_not(True)))
|
||||
.count()
|
||||
)
|
||||
author.stat['rating'] = likes_count - dislikes_count
|
||||
|
@@ -95,7 +95,7 @@ def patch_main_topic(session, main_topic, shout):
|
||||
.filter(
|
||||
and_(
|
||||
ShoutTopic.shout == shout.id,
|
||||
ShoutTopic.main == True,
|
||||
ShoutTopic.main.is_(True),
|
||||
)
|
||||
)
|
||||
.first()
|
||||
@@ -163,8 +163,7 @@ def patch_topics(session, shout, topics_input):
|
||||
async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
||||
user_id = info.context['user_id']
|
||||
roles = info.context['roles']
|
||||
if not shout_input:
|
||||
shout_input = {}
|
||||
shout_input = shout_input or {}
|
||||
with local_session() as session:
|
||||
author = session.query(Author).filter(Author.user == user_id).first()
|
||||
current_time = int(time.time())
|
||||
|
@@ -94,7 +94,7 @@ async def get_shout(_, _info, slug=None, shout_id=None):
|
||||
and_(
|
||||
ShoutTopic.topic == Topic.id,
|
||||
ShoutTopic.shout == shout.id,
|
||||
ShoutTopic.main == True,
|
||||
ShoutTopic.main.is_(True),
|
||||
),
|
||||
)
|
||||
.first()
|
||||
@@ -176,7 +176,7 @@ async def load_shouts_by(_, _info, options):
|
||||
and_(
|
||||
ShoutTopic.topic == Topic.id,
|
||||
ShoutTopic.shout == shout.id,
|
||||
ShoutTopic.main == True,
|
||||
ShoutTopic.main.is_(True),
|
||||
),
|
||||
)
|
||||
.first()
|
||||
@@ -223,7 +223,7 @@ async def load_shouts_drafts(_, info):
|
||||
and_(
|
||||
ShoutTopic.topic == Topic.id,
|
||||
ShoutTopic.shout == shout.id,
|
||||
ShoutTopic.main == True,
|
||||
ShoutTopic.main.is_(True),
|
||||
),
|
||||
)
|
||||
.first()
|
||||
@@ -297,7 +297,7 @@ async def load_shouts_feed(_, info, options):
|
||||
and_(
|
||||
ShoutTopic.topic == Topic.id,
|
||||
ShoutTopic.shout == shout.id,
|
||||
ShoutTopic.main == True,
|
||||
ShoutTopic.main.is_(True),
|
||||
),
|
||||
)
|
||||
.first()
|
||||
|
Reference in New Issue
Block a user