get-shout-fix
This commit is contained in:
parent
a771cd0617
commit
7bb70c41df
|
@ -288,8 +288,10 @@ async def get_shout(_, info, slug: str):
|
||||||
"rating": rating_stat,
|
"rating": rating_stat,
|
||||||
"last_reacted_at": last_reaction_at,
|
"last_reacted_at": last_reaction_at,
|
||||||
}
|
}
|
||||||
shout.authors = parse_aggregated_string(authors)
|
# Используем класс модели Author для преобразования строк в объекты
|
||||||
shout.topics = parse_aggregated_string(topics)
|
shout.authors = parse_aggregated_string(authors, Author)
|
||||||
|
# Используем класс модели Topic для преобразования строк в объекты
|
||||||
|
shout.topics = parse_aggregated_string(topics, Topic)
|
||||||
|
|
||||||
for author_caption in (
|
for author_caption in (
|
||||||
session.query(ShoutAuthor)
|
session.query(ShoutAuthor)
|
||||||
|
@ -303,8 +305,8 @@ async def get_shout(_, info, slug: str):
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
for author in shout.authors:
|
for author in shout.authors:
|
||||||
if author["id"] == str(author_caption.author):
|
if author.id == author_caption.author:
|
||||||
author["caption"] = author_caption.caption
|
author.caption = author_caption.caption
|
||||||
main_topic = (
|
main_topic = (
|
||||||
session.query(Topic.slug)
|
session.query(Topic.slug)
|
||||||
.join(
|
.join(
|
||||||
|
@ -323,7 +325,6 @@ async def get_shout(_, info, slug: str):
|
||||||
return shout
|
return shout
|
||||||
except Exception as _exc:
|
except Exception as _exc:
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user