Skip to content

Commit

Permalink
Fix sync videos not synced for new users
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHelalAhmed committed Sep 4, 2021
1 parent aa7b248 commit e8b0e8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/Services/SyncVideosForGivenChannelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function execute(Channel $channel)
$this->AddMoreVideosData(Arr::get($response, 'items', []), $channel);
}

$videos = $this->filterVideosToNotExistsVideos($this->getExistsRemoteIds());
$videos = $this->filterVideosToNotExistsVideos($this->getExistsRemoteIds($channel->id));

if ($videos->isNotEmpty()) {
return Video::insert($videos->toArray());
Expand Down Expand Up @@ -86,9 +86,11 @@ public function filterVideosToNotExistsVideos($existsRemoteIds): Collection
/**
* @return mixed
*/
public function getExistsRemoteIds()
public function getExistsRemoteIds($channelId)
{
return Video::Select('remote_identifier')->pluck('remote_identifier');
return Video::where('channel_id',$channelId)
->select('remote_identifier')
->pluck('remote_identifier');
}

}

0 comments on commit e8b0e8c

Please sign in to comment.