[system] / branches / gage_dev / webwork2 / lib / WeBWorK / ContentGenerator / Problem.pm Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /branches/gage_dev/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm

Revision 682 Revision 683
312 312
313 # attempt summary 313 # attempt summary
315 # print this if user submitted answers OR requested correct answers 315 # print this if user submitted answers OR requested correct answers
318 } elsif (\$previewAnswers) { 318 } elsif (\$previewAnswers) {
319 # print this if user previewed answers 319 # print this if user previewed answers
320 print \$self->attemptResults(\$pg, 1, 0, 0); 320 print \$self->attemptResults(\$pg, 1, 0, 0, 1);
321 # don't show correctness 321 # don't show correctness
322 # don't show correct answers 322 # don't show correct answers
323 } 323 }
324 324
325 # score summary 325 # score summary
450 my \$self = shift; 450 my \$self = shift;
451 my \$pg = shift; 451 my \$pg = shift;
452 my \$showAttemptAnswers = shift; 452 my \$showAttemptAnswers = shift;
453 my \$showCorrectAnswers = shift; 453 my \$showCorrectAnswers = shift;
454 my \$showAttemptResults = \$showAttemptAnswers && shift; 454 my \$showAttemptResults = \$showAttemptAnswers && shift;
455 my \$showAttemptPreview = shift || 0;
455 my \$problemResult = \$pg->{result}; # the overall result of the problem 456 my \$problemResult = \$pg->{result}; # the overall result of the problem
456 my @answerNames = @{ \$pg->{flags}->{ANSWER_ENTRY_ORDER} }; 457 my @answerNames = @{ \$pg->{flags}->{ANSWER_ENTRY_ORDER} };
457 458
459 \$header .= \$showAttemptAnswers ? CGI::th("attempt") : ""; 460 \$header .= \$showAttemptAnswers ? CGI::th("attempt") : "";
460 \$header .= \$showAttemptAnswers ? CGI::th("preview") : ""; 461 \$header .= \$showAttemptPreview ? CGI::th("preview") : "";
461 \$header .= \$showCorrectAnswers ? CGI::th("correct") : ""; 462 \$header .= \$showCorrectAnswers ? CGI::th("correct") : "";
462 \$header .= \$showAttemptResults ? CGI::th("result") : ""; 463 \$header .= \$showAttemptResults ? CGI::th("result") : "";
463 \$header .= \$showAttemptAnswers ? CGI::th("messages") : ""; 464 \$header .= \$showAttemptAnswers ? CGI::th("messages") : "";
464 my @tableRows = ( \$header ); 465 my @tableRows = ( \$header );
465 my \$numCorrect; 466 my \$numCorrect;
466 foreach my \$name (@answerNames) { 467 foreach my \$name (@answerNames) {
468 my \$studentAnswer = \$answerResult->{student_ans}; # original_student_ans 469 my \$studentAnswer = \$answerResult->{student_ans}; # original_student_ans
469 my \$preview = \$self->previewAnswer(\$answerResult); 470 my \$preview = (\$showAttemptPreview
472 : "");
473 476
474 \$numCorrect += \$answerScore > 0; 477 \$numCorrect += \$answerScore > 0;
475 my \$resultString = \$answerScore ? "correct" : "incorrect"; 478 my \$resultString = \$answerScore ? "correct" : "incorrect";
476 479
477 # get rid of the goofy prefix on the answer names (supposedly, the format 480 # get rid of the goofy prefix on the answer names (supposedly, the format
478 # of the answer names is changeable. this only fixes 481 # of the answer names is changeable. this only fixes it for "AnSwEr"
479 \$name =~ s/^AnSwEr//; 482 \$name =~ s/^AnSwEr//;
480 483
481 my \$row = CGI::td(\$name); 484 my \$row = CGI::td(\$name);
482 \$row .= \$showAttemptAnswers ? CGI::td(\$studentAnswer) : ""; 485 \$row .= \$showAttemptAnswers ? CGI::td(\$studentAnswer) : "";
483 \$row .= \$showAttemptAnswers ? CGI::td(\$preview) : ""; 486 \$row .= \$showAttemptPreview ? CGI::td(\$preview) : "";
484 \$row .= \$showCorrectAnswers ? CGI::td(\$correctAnswer) : ""; 487 \$row .= \$showCorrectAnswers ? CGI::td(\$correctAnswer) : "";
485 \$row .= \$showAttemptResults ? CGI::td(\$resultString) : ""; 488 \$row .= \$showAttemptResults ? CGI::td(\$resultString) : "";
486 \$row .= \$answerMessage ? CGI::td(\$answerMessage) : ""; 489 \$row .= \$answerMessage ? CGI::td(\$answerMessage) : "";
487 push @tableRows, \$row; 490 push @tableRows, \$row;
488 } 491 }

Legend:
 Removed from v.682 changed lines Added in v.683

 aubreyja at gmail dot com ViewVC Help Powered by ViewVC 1.0.9