This commit is contained in:
parent
493e6cf92c
commit
92e49c8ad9
|
@ -94,6 +94,7 @@ def query_with_stat(info):
|
||||||
if has_field(info, "topics"):
|
if has_field(info, "topics"):
|
||||||
topics_subquery = (
|
topics_subquery = (
|
||||||
select(
|
select(
|
||||||
|
ShoutTopic.shout,
|
||||||
json_array_builder(
|
json_array_builder(
|
||||||
json_builder(
|
json_builder(
|
||||||
"id", Topic.id,
|
"id", Topic.id,
|
||||||
|
@ -105,6 +106,7 @@ def query_with_stat(info):
|
||||||
)
|
)
|
||||||
.outerjoin(Topic, ShoutTopic.topic == Topic.id)
|
.outerjoin(Topic, ShoutTopic.topic == Topic.id)
|
||||||
.where(ShoutTopic.shout == Shout.id)
|
.where(ShoutTopic.shout == Shout.id)
|
||||||
|
.group_by(ShoutTopic.shout)
|
||||||
.subquery()
|
.subquery()
|
||||||
)
|
)
|
||||||
q = q.outerjoin(topics_subquery, topics_subquery.c.shout == Shout.id)
|
q = q.outerjoin(topics_subquery, topics_subquery.c.shout == Shout.id)
|
||||||
|
@ -126,6 +128,7 @@ def query_with_stat(info):
|
||||||
)
|
)
|
||||||
.outerjoin(Author, ShoutAuthor.author == Author.id)
|
.outerjoin(Author, ShoutAuthor.author == Author.id)
|
||||||
.where(ShoutAuthor.shout == Shout.id)
|
.where(ShoutAuthor.shout == Shout.id)
|
||||||
|
.group_by(ShoutAuthor.shout)
|
||||||
.subquery()
|
.subquery()
|
||||||
)
|
)
|
||||||
q = q.outerjoin(authors_subquery, authors_subquery.c.shout == Shout.id)
|
q = q.outerjoin(authors_subquery, authors_subquery.c.shout == Shout.id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user