| … | |
… | |
| 725 | $timeInterval = 0 if (! defined($timeInterval) || $timeInterval eq ''); |
725 | $timeInterval = 0 if (! defined($timeInterval) || $timeInterval eq ''); |
| 726 | $versionsPerInterval = 0 if (! defined($versionsPerInterval) || |
726 | $versionsPerInterval = 0 if (! defined($versionsPerInterval) || |
| 727 | $versionsPerInterval eq ''); |
727 | $versionsPerInterval eq ''); |
| 728 | |
728 | |
| 729 | # every problem in the set must have the same submission characteristics |
729 | # every problem in the set must have the same submission characteristics |
|
|
730 | |
| 730 | my $currentNumAttempts = ( defined($Problem) && $Problem->num_correct ) ? |
731 | my $currentNumAttempts = ( defined($Problem) && |
|
|
732 | $Problem->num_correct() ne '' ) ? |
| 731 | $Problem->num_correct() + |
733 | $Problem->num_correct() + |
| 732 | $Problem->num_incorrect() : 0 ; |
734 | $Problem->num_incorrect() : 0; |
|
|
735 | |
| 733 | |
736 | |
| 734 | # $maxAttempts turns into the maximum number of versions we can create; |
737 | # $maxAttempts turns into the maximum number of versions we can create; |
| 735 | # if $Problem isn't defined, we can't have made any attempts, so it |
738 | # if $Problem isn't defined, we can't have made any attempts, so it |
| 736 | # doesn't matter |
739 | # doesn't matter |
| 737 | my $maxAttempts = ( defined($Problem) && |
740 | my $maxAttempts = ( defined($Problem) && |
| … | |
… | |
| 1578 | # order that they are presented, not the |
1581 | # order that they are presented, not the |
| 1579 | # actual problem order |
1582 | # actual problem order |
| 1580 | if ( ref( $pg_results[$probOrder[$i]] ) ) { |
1583 | if ( ref( $pg_results[$probOrder[$i]] ) ) { |
| 1581 | my %answerHash = %{ $pg_results[$probOrder[$i]]->{answers} }; |
1584 | my %answerHash = %{ $pg_results[$probOrder[$i]]->{answers} }; |
| 1582 | foreach ( sortByName(undef, keys %answerHash) ) { |
1585 | foreach ( sortByName(undef, keys %answerHash) ) { |
| 1583 | my $sAns = $answerHash{$_}->{original_student_ans} || ''; |
1586 | my $sAns = defined($answerHash{$_}->{original_student_ans}) ? $answerHash{$_}->{original_student_ans} : ''; |
| 1584 | $answerString .= $sAns . "\t"; |
1587 | $answerString .= $sAns . "\t"; |
| 1585 | $scores .= $answerHash{$_}->{score}>=1 ? "1" : "0" if ( $submitAnswers ); |
1588 | $scores .= $answerHash{$_}->{score}>=1 ? "1" : "0" if ( $submitAnswers ); |
| 1586 | } |
1589 | } |
| 1587 | } else { |
1590 | } else { |
| 1588 | my $prefix = sprintf('Q%04d_', ($probOrder[$i]+1)); |
1591 | my $prefix = sprintf('Q%04d_', ($probOrder[$i]+1)); |
| … | |
… | |
| 2073 | |
2076 | |
| 2074 | print CGI::start_div({class=>"gwProblem"}); |
2077 | print CGI::start_div({class=>"gwProblem"}); |
| 2075 | my $i1 = $i+1; |
2078 | my $i1 = $i+1; |
| 2076 | my $pv = $problems[$probOrder[$i]]->value() ? $problems[$probOrder[$i]]->value() : 1; |
2079 | my $pv = $problems[$probOrder[$i]]->value() ? $problems[$probOrder[$i]]->value() : 1; |
| 2077 | my $points = ($pv > 1) ? |
2080 | my $points = ($pv > 1) ? |
| 2078 | " (" . $$pv . " points)" : |
2081 | " (" . $pv . " points)" : |
| 2079 | " (1 point)"; |
2082 | " (1 point)"; |
| 2080 | print CGI::a({-name=>"#$i1"},""); |
2083 | print CGI::a({-name=>"#$i1"},""); |
| 2081 | print CGI::strong("Problem $problemNumber."), |
2084 | print CGI::strong("Problem $problemNumber."), |
| 2082 | "$points\n", $recordMessage; |
2085 | "$points\n", $recordMessage; |
| 2083 | print CGI::p($pg->{body_text}), |
2086 | print CGI::p($pg->{body_text}), |