Skip to content

Commit

Permalink
Add method for sorting by season/episode.
Browse files Browse the repository at this point in the history
This makes season/episode sorting actually work correctly, while before,
clicking on the column to sort by it would instead fall through to a
title sort.

Fixes #10422
  • Loading branch information
wagnerrp committed Mar 9, 2012
1 parent a14066c commit b2d1d24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions includes/sorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ function by_subtitle(&$a, &$b) {
return by_no_articles($a->subtitle, $b->subtitle);
}

function by_season(&$a, &$b) {
$asep = $a->season.'x'.str_pad($a->episode,2,"0",STR_PAD_LEFT);
$bsep = $b->season.'x'.str_pad($b->episode,2,"0",STR_PAD_LEFT);
return strcasecmp($asep, $bsep);
}

function by_type(&$a, &$b) {
return strcasecmp($a->texttype, $b->texttype);
}
Expand Down

0 comments on commit b2d1d24

Please sign in to comment.