Skip to content

Commit

Permalink
Correct method of counting the number of error messages.
Browse files Browse the repository at this point in the history
The previous syntax always left exactly one element in the array even if there were not warning messages.
  • Loading branch information
mgage committed Jun 24, 2012
1 parent 931329c commit e692a16
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/WeBWorK/ContentGenerator/Problem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -733,13 +733,13 @@ sub pre_header_initialize {
$can{showSolutions} &&= $pg->{flags}->{solutionExists};

##### record errors #########
my @debug_messages = join(CGI::br(), @{$pg->{pgcore}->get_debug_messages } );
my @warning_messages = join(CGI::br(), @{$pg->{pgcore}->get_warning_messages} );
my @internal_errors = join(CGI::br(), @{$pg->{pgcore}->get_internal_debug_messages} );
my @debug_messages = @{$pg->{pgcore}->get_debug_messages};
my @warning_messages = @{$pg->{pgcore}->get_warning_messages};
my @internal_errors = @{$pg->{pgcore}->get_internal_debug_messages};
$self->{pgerrors} = @debug_messages||@warning_messages||@internal_errors; # is 1 if any of these are non-empty
$self->{pgdebug} = \@debug_messages;
$self->{pgwarning} = \@warning_messages;
$self->{pginternalerrors} = \@internal_errors;
$self->{pgdebug} = \@debug_messages;
$self->{pgwarning} = \@warning_messages;
$self->{pginternalerrors} = \@internal_errors ;

##### store fields #####

Expand Down Expand Up @@ -776,7 +776,7 @@ sub warnings {
}
# print "proceeding to SUPER::warnings";
$self->SUPER::warnings();
#$self->{pgerrors};
print $self->{pgerrors};
""; #FIXME -- let's see if this is the appropriate output.
}

Expand Down

0 comments on commit e692a16

Please sign in to comment.