mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Another attempted bug fix
This commit is contained in:
parent
f85b1ecdeb
commit
0e6afe372b
2 changed files with 11 additions and 3 deletions
|
@ -179,9 +179,9 @@ class EditTrackCommand extends CommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime("2016-12-18 00:00:00")) {
|
if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime("2016-12-18 00:00:00")) {
|
||||||
$playlist = Playlist::where('id', 658)->first();
|
$playlist = Playlist::where('user_id', 22549)->first();
|
||||||
|
|
||||||
if ($this->_input['hwc_submit'] === true) {
|
if ($this->_input['hwc_submit'] == true) {
|
||||||
if (!$playlist->tracks()->get()->contains($track)) {
|
if (!$playlist->tracks()->get()->contains($track)) {
|
||||||
$songIndex = $playlist->trackCount() + 1;
|
$songIndex = $playlist->trackCount() + 1;
|
||||||
$playlist->tracks()->attach($track, ['position' => $songIndex]);
|
$playlist->tracks()->attach($track, ['position' => $songIndex]);
|
||||||
|
@ -191,6 +191,14 @@ class EditTrackCommand extends CommandBase
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ($playlist->tracks()->get()->contains($track)) {
|
||||||
|
$playlist->tracks()->detach($track);
|
||||||
|
|
||||||
|
Playlist::whereId($playlist->id)->update([
|
||||||
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -534,7 +534,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
||||||
$returnValue['username'] = User::whereId($track->user_id)->first()->username;
|
$returnValue['username'] = User::whereId($track->user_id)->first()->username;
|
||||||
|
|
||||||
// Seasonal
|
// Seasonal
|
||||||
$returnValue['hwc_submit'] = Playlist::where('id', 658)->first()->tracks()->get()->contains($track);
|
$returnValue['hwc_submit'] = Playlist::where('user_id', 22549)->first()->tracks()->get()->contains($track);
|
||||||
|
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue