mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-21 20:48:00 +01:00
Fixed genre deletion
This commit is contained in:
parent
15ab486a50
commit
9e63702387
1 changed files with 7 additions and 11 deletions
|
@ -47,10 +47,6 @@ class DeleteGenre extends Job implements ShouldQueue
|
|||
$this->executingUser = Auth::user();
|
||||
$this->genreToDelete = $genreToDelete;
|
||||
$this->destinationGenre = $destinationGenre;
|
||||
|
||||
// The genre is deleted synchronously before the job is executed in
|
||||
// order to prevent race conditions.
|
||||
$this->genreToDelete->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,14 +63,14 @@ class DeleteGenre extends Job implements ShouldQueue
|
|||
|
||||
// This is done instead of a single UPDATE query in order to
|
||||
// generate revision logs for the change.
|
||||
$this->genreToDelete->tracks()->chunk(200, function ($tracks) {
|
||||
foreach ($tracks as $track) {
|
||||
/** @var Track $track */
|
||||
$this->genreToDelete->tracks()->each(function ($track) {
|
||||
/** @var Track $track */
|
||||
|
||||
$track->genre_id = $this->destinationGenre->id;
|
||||
$track->save();
|
||||
$track->updateTags();
|
||||
}
|
||||
$track->genre_id = $this->destinationGenre->id;
|
||||
$track->save();
|
||||
$track->updateTags();
|
||||
});
|
||||
|
||||
$this->genreToDelete->delete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue