stat-fix-6
This commit is contained in:
parent
ebe034a527
commit
89c453fedc
|
@ -88,15 +88,9 @@ async def get_shout(_, _info, slug=None, shout_id=None):
|
||||||
try:
|
try:
|
||||||
author_stats = session.execute(q).first()
|
author_stats = session.execute(q).first()
|
||||||
if author_stats:
|
if author_stats:
|
||||||
[
|
[shout, reacted_stat, commented_stat, rating_stat, _last_comment] = author_stats
|
||||||
shout,
|
|
||||||
reacted_stat,
|
|
||||||
commented_stat,
|
|
||||||
rating_stat,
|
|
||||||
_last_comment,
|
|
||||||
] = author_stats
|
|
||||||
shout.stat = {
|
shout.stat = {
|
||||||
"viewed": ViewedStorage.get_shout(shout.slug),
|
"viewed": shout.views,
|
||||||
"reacted": reacted_stat,
|
"reacted": reacted_stat,
|
||||||
"commented": commented_stat,
|
"commented": commented_stat,
|
||||||
"rating": rating_stat,
|
"rating": rating_stat,
|
||||||
|
@ -228,20 +222,15 @@ async def load_shouts_feed(_, info, options):
|
||||||
q = q.group_by(Shout.id).order_by(nulls_last(query_order_by)).limit(limit).offset(offset)
|
q = q.group_by(Shout.id).order_by(nulls_last(query_order_by)).limit(limit).offset(offset)
|
||||||
|
|
||||||
shouts = []
|
shouts = []
|
||||||
for [
|
for [shout, reacted_stat, commented_stat, rating_stat, _last_comment] in session.execute(q).unique():
|
||||||
shout,
|
|
||||||
reacted_stat,
|
|
||||||
commented_stat,
|
|
||||||
rating_stat,
|
|
||||||
_last_comment,
|
|
||||||
] in session.execute(q).unique():
|
|
||||||
shout.stat = {
|
shout.stat = {
|
||||||
"viewed": ViewedStorage.get_shout(shout.slug),
|
"viewed": shout.views,
|
||||||
"reacted": reacted_stat,
|
"reacted": reacted_stat,
|
||||||
"commented": commented_stat,
|
"commented": commented_stat,
|
||||||
"rating": rating_stat,
|
"rating": rating_stat,
|
||||||
}
|
}
|
||||||
shouts.append(shout)
|
shouts.append(shout)
|
||||||
|
|
||||||
return shouts
|
return shouts
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user