подписки сразу отслеживаются
This commit is contained in:
@@ -74,8 +74,8 @@ async def get_placement_user(self: 'Usecase', input: dto.GetPlacementInput) -> d
|
||||
placement_id=placement.id,
|
||||
include_archived=True,
|
||||
)
|
||||
placement_post_ids = [post.id for post in placement_posts]
|
||||
subscriptions_counts = await self.database.count_subscriptions_by_placement_post_batch(placement_post_ids)
|
||||
# Подсчёт подписок по placement_id (один Placement = одна ссылка = один счётчик подписок)
|
||||
subscriptions_count = await self.database.count_subscriptions_by_placement(placement.id)
|
||||
post_ids = [placement_post.post.id for placement_post in placement_posts if placement_post.post]
|
||||
views_map = await self.database.get_latest_views_data_batch(post_ids) if post_ids else {}
|
||||
|
||||
@@ -89,7 +89,7 @@ async def get_placement_user(self: 'Usecase', input: dto.GetPlacementInput) -> d
|
||||
views_count = views_map.get(placement_post.post.id, (None,))[0]
|
||||
placement_post_output = _build_placement_post_output(
|
||||
placement_post,
|
||||
subscriptions_counts.get(placement_post.id, 0),
|
||||
subscriptions_count,
|
||||
views_count,
|
||||
)
|
||||
if placement_post_output is not None:
|
||||
|
||||
Reference in New Issue
Block a user