Skip to content

Commit

Permalink
Use the admin_course_id variable from the course environment instead
Browse files Browse the repository at this point in the history
of assuming the admin course is named 'admin'.  It falls back to using
'admin' if that variable is undefined.
  • Loading branch information
drgrice1 committed Feb 13, 2024
1 parent 5599d67 commit 4b877e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/dump-past-answers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ BEGIN

pod2usage(2) if $show_help;

@courses = listCourses(WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT} })) unless @courses;
my $minimal_ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT} });
@courses = listCourses($minimal_ce) unless @courses;

sub write_past_answers_csv {
my $outFH = shift;
Expand All @@ -132,7 +133,7 @@ sub write_past_answers_csv {
my %OPL_tag_data;

for my $courseID (@courses) {
next if $courseID eq 'admin' || $courseID eq 'modelCourse';
next if $courseID eq ($minimal_ce->{admin_course_id} // 'admin') || $courseID eq 'modelCourse';

my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, courseName => $courseID });
my $db = WeBWorK::DB->new($ce->{dbLayout});
Expand Down

0 comments on commit 4b877e4

Please sign in to comment.