From: Sam H. v. a. <we...@ma...> - 2007-08-25 18:27:38
|
Log Message: ----------- backport (glarose): bug fix. when updating to hide set header display I assumed that the $db->getMergedSet($userToShow, $setID) would succeed, which isn't the case for a set that isn't assigned to any users (in particular, which isn't assigned to the instructor who is editing the set). this bug fix resolves that by instead using the global set to determine if headers should be displayed when the call to get the merged set fails. Tags: ---- rel-2-4-dev Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator/Instructor: ProblemSetDetail.pm Revision Data ------------- Index: ProblemSetDetail.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm,v retrieving revision 1.64.2.3 retrieving revision 1.64.2.4 diff -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -u -r1.64.2.3 -r1.64.2.4 --- lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm +++ lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm @@ -1713,6 +1713,14 @@ my %error; my $this_set = $db->getMergedSet($userToShow, $setID); + my $guaranteed_set = $this_set; + if ( ! $guaranteed_set ) { + # in the header loop we need to have a set that + # we know exists, so if the getMergedSet failed + # (that is, the set isn't assigned to the + # the current user), we get the global set instead + $guaranteed_set = $db->getGlobalSet( $setID ); + } foreach my $header (@headers) { @@ -1746,7 +1754,7 @@ # edit/view it in this context, so we don't show this # field for gateway tests if ( $header eq 'set_header' && - $this_set->assignment_type =~ /gateway/ ) { + $guaranteed_set->assignment_type =~ /gateway/ ) { print CGI::Tr({}, CGI::td({}, [ "Set Header", "Set headers are not used in " . |