подписки сразу отслеживаются
This commit is contained in:
@@ -34,8 +34,8 @@ async def get_placements(self: 'Usecase', input: dto.GetPlacementsInput) -> dto.
|
||||
placement_ids,
|
||||
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_counts = await self.database.count_subscriptions_by_placement_batch(placement_ids)
|
||||
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 {}
|
||||
|
||||
@@ -46,7 +46,7 @@ async def get_placements(self: 'Usecase', input: dto.GetPlacementsInput) -> dto.
|
||||
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_counts.get(placement_post.placement_id, 0),
|
||||
views_count,
|
||||
)
|
||||
if placement_post_output is None:
|
||||
|
||||
Reference in New Issue
Block a user