Skip to content

Commit

Permalink
Also use the Instructor.pm getDefList method in SetMaker.pm when it
Browse files Browse the repository at this point in the history
loads the set definitions for the "Set Definition Files" part, and
remove the method it was using that was not as full featured.
  • Loading branch information
drgrice1 committed Apr 8, 2022
1 parent 1590c60 commit 1ecdb0d
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,6 @@ sub list_pg_files {
return sortByName(undef,@pgs);
}

## Search for set definition files

sub get_set_defs {
my $topdir = shift;
my @found_set_defs;
# get_set_defs_wanted is a closure over @found_set_defs
my $get_set_defs_wanted = sub {
#my $fn = $_;
#my $fdir = $File::Find::dir;
#return() if($fn !~ /^set.*\.def$/);
##return() if(not -T $fn);
#push @found_set_defs, "$fdir/$fn";
push @found_set_defs, $_ if m|/set[^/]*\.def$|;
};
find({ wanted => $get_set_defs_wanted, follow_fast=>1, no_chdir=>1}, $topdir);
map { $_ =~ s|^$topdir/?|| } @found_set_defs;
return @found_set_defs;
}

## Try to make reading of set defs more flexible. Additional strategies
## for fixing a path can be added here.

Expand Down Expand Up @@ -957,11 +938,7 @@ sub browse_setdef_panel {
my $ce = $r->ce;
my $library_selected = shift // '';

# In the following line, the parens after sort are important. If they are
# omitted, sort will interpret get_set_defs as the name of the comparison
# function, and ($ce->{courseDirs}{templates}) as a single element list to
# be sorted.
my @list_of_set_defs = sort(get_set_defs($ce->{courseDirs}{templates}));
my @list_of_set_defs = $self->getDefList;
my $labels_for_set_defs = { map { $_ => $_ } @list_of_set_defs };

if (scalar(@list_of_set_defs) == 0) {
Expand Down

0 comments on commit 1ecdb0d

Please sign in to comment.