From 3fe8a91f7073d15a972d23a9859848c622d79223 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 19 Jan 2024 18:22:17 -0600 Subject: [PATCH] Use the `admin_course_id` variable from the course environment instead of assuming the admin course is named 'admin'. It falls back to using 'admin' if that variable is undefined. --- bin/dump-past-answers.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/dump-past-answers.pl b/bin/dump-past-answers.pl index d4dc3082a7..f9fbb10840 100755 --- a/bin/dump-past-answers.pl +++ b/bin/dump-past-answers.pl @@ -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; @@ -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});