Skip to content

Commit

Permalink
Move answer stringification after content post processing.
Browse files Browse the repository at this point in the history
This is so that the content post processor methods have access to the
full answer objects.  This gives this approach a whole lot more power
than the (soon to be eliminated) results table has.
  • Loading branch information
drgrice1 committed Sep 16, 2023
1 parent 36847ec commit 1ac773e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/WeBWorK/PG.pm
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ sub new_helper ($invocant, %options) {
}

$translator->post_process_content;
$translator->stringify_answers;

# HTML_dpng uses an ImageGenerator. We have to render the queued equations.
if ($image_generator) {
Expand Down
2 changes: 1 addition & 1 deletion lib/WeBWorK/PG/Translator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ WeBWorK::PG::Translator - Evaluate PG code and evaluate answers safely
my $rh_problem_result = $pt->grade_problem(%options); # grades the problem.
$pt->post_process_content; # Execute macro or problem hooks that further modify the problem content.
$pt->stringify_answers; # Convert objects to strings in the answer hash
=head1 DESCRIPTION
Expand Down Expand Up @@ -1059,7 +1060,6 @@ sub grade_problem {
use strict;

die $@ if $@;
$self->stringify_answers;
return ($self->{rh_problem_result}, $self->{rh_problem_state});
}

Expand Down

0 comments on commit 1ac773e

Please sign in to comment.