@@ -107,10 +107,10 @@ sub process_pg_file {
107107# ######################################################################
108108
109109sub process_problem {
110- my ($problem , $inputs_ref ) = @_ ;
110+ my ($problem , $inputs_ref ) = @_ ;
111111
112- my $source = $problem -> {problem_contents };
113- my $file_path = $inputs_ref -> {sourceFilePath } || $inputs_ref -> {problemSourceURL };
112+ my $source = $problem -> {problem_contents };
113+ my $file_path = $inputs_ref -> {sourceFilePath } || $inputs_ref -> {problemSourceURL };
114114 my ($raw_metadata_text , $problemUUID );
115115
116116 # TODO: include problemUUID from problemSourceURL and skip this if present
@@ -153,7 +153,7 @@ sub process_problem {
153153 if ($inputs_ref -> {previewAnswers }) {
154154 # if this is a preview, leave session unmodified, and no answerJWT
155155 $return_object -> {sessionJWT } = $inputs_ref -> {sessionJWT };
156- } else {
156+ } elsif ( $inputs_ref -> { problemJWT }) {
157157 my ($sessionJWT , $answerJWT ) = generateJWTs($return_object , $inputs_ref );
158158 $return_object -> {sessionJWT } = $sessionJWT ;
159159 $return_object -> {answerJWT } = $answerJWT ;
@@ -251,10 +251,10 @@ sub standaloneRenderer {
251251 flags => $pg -> {flags },
252252 };
253253 if (ref ($pg -> {pgcore }) eq ' PGcore' ) {
254- $ret -> {internal_debug_messages } = $pg -> {pgcore }-> get_internal_debug_messages();
255- $ret -> {warning_messages } = $pg -> {pgcore }-> get_warning_messages();
256- $ret -> {debug_messages } = $pg -> {pgcore }-> get_debug_messages();
257- $ret -> {resources } = [ keys %{ $pg -> {pgcore }{PG_alias }{resource_list } } ];
254+ $ret -> {internal_debug_messages } = $pg -> {pgcore }-> get_internal_debug_messages();
255+ $ret -> {warning_messages } = $pg -> {pgcore }-> get_warning_messages();
256+ $ret -> {debug_messages } = $pg -> {pgcore }-> get_debug_messages();
257+ # $ret->{resources} = [ keys %{ $pg->{pgcore}{PG_alias}{resource_list} } ];
258258 $ret -> {PERSISTENCE_HASH_UPDATED } = $pg -> {pgcore }{PERSISTENCE_HASH_UPDATED };
259259 $ret -> {PERSISTENCE_HASH } = $pg -> {pgcore }{PERSISTENCE_HASH };
260260 $ret -> {PG_ANSWERS_HASH } = {
@@ -267,10 +267,10 @@ sub standaloneRenderer {
267267 keys %{ $pg -> {pgcore }{PG_ANSWERS_HASH } }
268268 };
269269 # TODO: replace resources after PG merges #1046
270- # $ret->{resource_list } = {
271- # map { $_ => $pg->{pgcore}{PG_alias}{resource_list}{$_}{uri} }
272- # keys %{ $pg->{pgcore}{PG_alias}{resource_list} }
273- # };
270+ $ret -> {resources } = {
271+ map { $_ => $pg -> {pgcore }{PG_alias }{resource_list }{$_ }{uri } }
272+ keys %{ $pg -> {pgcore }{PG_alias }{resource_list } }
273+ };
274274 } else {
275275 $ret -> {internal_debug_messages } = [' Problem failed during render - no PGcore received.' ];
276276 }
@@ -319,11 +319,8 @@ sub generateJWTs {
319319 }
320320
321321 # store the current answer/response state for each entry
322- foreach my $ans (keys %{ $scoreHash -> {answers } }) {
323- # TODO: Anything else we want to add to sessionHash?
322+ foreach my $ans (@{ $pg -> {flags }{KEPT_EXTRA_ANSWERS } }) {
324323 $sessionHash -> {$ans } = $inputs_ref -> {$ans };
325- $sessionHash -> { ' MaThQuIlL_' . $ans } = $inputs_ref -> { ' MaThQuIlL_' . $ans }
326- if ($inputs_ref -> { ' MaThQuIlL_' . $ans });
327324
328325# More restructuring -- confirm with LibreTexts
329326# $scoreHash->{$ans}{student} = { map {exists $answers{$ans}{$_} ? ($studentKeys{$_} => $answers{$ans}{$_}) : ()} keys %studentKeys };
0 commit comments