Skip to content

Commit 6c8d48a

Browse files
authored
Merge pull request #20 from OneWalkDev/dev
fix exchange logic
2 parents 2c95508 + 6b31b57 commit 6c8d48a

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

backend/app/Services/PostService.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,12 @@ public function createPost(User $user, array $data): array
6363
// Attach genres
6464
$this->postRepository->attachGenres($post, $data['genre_ids']);
6565

66-
// Create pool entry
67-
$poolEntry = $this->poolEntryRepository->create([
66+
// Create pool entry
67+
$this->poolEntryRepository->create([
6868
'post_id' => $post->id,
6969
'is_consumed' => false,
7070
]);
7171

72-
// 1. Find waiting users and assign them the new post
73-
$waitingExchange = $this->exchangeRepository->findWaitingExchange($user, $track);
74-
75-
if ($waitingExchange) {
76-
$this->poolEntryRepository->markAsConsumed($poolEntry);
77-
$this->exchangeRepository->update($waitingExchange, [
78-
'received_post_id' => $post->id,
79-
]);
80-
}
81-
82-
// 2. Find a song for current user
8372
$receivedTrackIds = $this->exchangeRepository->getReceivedTrackIds($user);
8473
$availablePoolEntry = $this->poolEntryRepository->findAvailableEntry($user, $receivedTrackIds);
8574

0 commit comments

Comments
 (0)