Skip to content

Commit

Permalink
Merge pull request #2509 from drgrice1/problem-set-list-fallback-sort
Browse files Browse the repository at this point in the history
Add a fallback sort to the problem set list (the Sets Manager)
  • Loading branch information
Alex-Jordan committed Aug 13, 2024
2 parents c07092e + fcabc7f commit 629f1c9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,21 @@ sub initialize ($c) {

$c->stash->{formsToShow} = $c->{editMode} ? EDIT_FORMS() : $c->{exportMode} ? EXPORT_FORMS() : VIEW_FORMS();
$c->stash->{setDefList} = [ getDefList($ce) ] unless $c->{editMode} || $c->{exportMode};

# Get requested sets in the requested order.
$c->stash->{sets} = [
@{ $c->{visibleSetIDs} }
? $db->getGlobalSetsWhere({ set_id => $c->{visibleSetIDs} },
\("$c->{primarySortField} $c->{primarySortOrder}, $c->{secondarySortField} $c->{secondarySortOrder}"))
? $db->getGlobalSetsWhere(
{ set_id => $c->{visibleSetIDs} },
\(
"$c->{primarySortField} $c->{primarySortOrder}, "
. "$c->{secondarySortField} $c->{secondarySortOrder}"
. (
$c->{primarySortField} ne 'set_id'
&& $c->{secondarySortField} ne 'set_id' ? ', set_id ASC' : ''
)
)
)
: ()
];

Expand Down

0 comments on commit 629f1c9

Please sign in to comment.