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 4570fa5 commit 6c5d956
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 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 @@ -961,7 +942,7 @@ sub browse_setdef_panel {
# 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 6c5d956

Please sign in to comment.