правки

This commit is contained in:
Artem Tsyrulnikov
2026-02-03 19:53:20 +03:00
parent fc2d4263d3
commit 7c8589e000

View File

@@ -102,16 +102,14 @@ async def get_placements_analytics(
allowed_project_ids=allowed_project_ids, allowed_project_ids=allowed_project_ids,
) )
placement_post_ids = [p.id for p in placements] # Extract placement_post_ids and post_ids from placement.placement_posts
post_ids = ( placement_post_ids = [pp.id for p in placements for pp in p.placement_posts]
[ post_ids = [
p.post.id pp.post.id
for p in placements for p in placements
if hasattr(p, 'placement_posts') and p.placement_posts and p.placement_posts[0].post for pp in p.placement_posts
if pp.post
] ]
if placements
else []
)
views_map = await self.database.get_latest_views_data_batch(post_ids) if post_ids else {} views_map = await self.database.get_latest_views_data_batch(post_ids) if post_ids else {}
subscriptions_counts = ( subscriptions_counts = (
await self.database.count_subscriptions_by_placement_post_batch(placement_post_ids) await self.database.count_subscriptions_by_placement_post_batch(placement_post_ids)