public function postsPosition($sortedPosts)
{
if ($sortedPosts->count() === 0) {
return [];
}
$firstPostPosition = $this->postPosition($sortedPosts->first()->post_id);
$postIds = $sortedPosts->map(function ($p) {
return $p->post_id;
});
$buf = [];
$currentPostPosition = $firstPostPosition;
foreach ($postIds as $postId) {
$buf[$postId] = $currentPostPosition;
$currentPostPosition++;
}
return $buf;
}