Commit d7b6794f authored by Benjamin Bellamy's avatar Benjamin Bellamy 💬 Committed by Yassine Doghri
Browse files

fix: sort episodic podcasts by season

parent 23798263
......@@ -270,7 +270,7 @@ class EpisodeModel extends Model
$sortNumberField =
$podcastType == 'serial'
? 'if(isnull(season_number),0,season_number)*1000+number'
: 'published_at';
: 'if(isnull(season_number),0,season_number)*100000000000000+published_at';
$sortNumberValue =
$podcastType == 'serial'
? (empty($episode->season_number)
......@@ -278,7 +278,11 @@ class EpisodeModel extends Model
: $episode->season_number) *
1000 +
$episode->number
: $episode->published_at;
: (empty($episode->season_number)
? 0
: $episode->season_number) *
100000000000000 +
date('YmdHis', strtotime($episode->published_at));
$previousData = $this->orderBy('(' . $sortNumberField . ') DESC')
->where([
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment