stat-dict
All checks were successful
Deploy on push / deploy (push) Successful in 6s

This commit is contained in:
Untone 2024-11-01 21:09:53 +03:00
parent 154477e1ad
commit 0874794140

View File

@ -220,12 +220,13 @@ def get_shouts_with_links(info, q, limit=20, offset=0):
"slug": a.slug, "slug": a.slug,
"pic": a.pic, "pic": a.pic,
} }
# logger.info({ **shout_dict, "body": "", "media": []}) if hasattr(row, "stat") and isinstance(row.stat, dict):
stat = json.loads(row.stat) if hasattr(row, "stat") else {} viewed = ViewedStorage.get_shout(shout_id=shout_id) or 0
viewed = ViewedStorage.get_shout(shout_id=shout_id) or 0 shout_dict["stat"] = {
stat["viewed"] = viewed **row.stat,
if stat: "viewed": viewed,
shout_dict["stat"] = {**stat, "commented": stat.get("comments_count", 0)} "commented": row.stat.get("comments_count", 0)
}
if has_field(info, "main_topic") and hasattr(row, "main_topic"): if has_field(info, "main_topic") and hasattr(row, "main_topic"):
shout_dict["main_topic"] = json.loads(row.main_topic) shout_dict["main_topic"] = json.loads(row.main_topic)