| … | |
… | |
| 209 | recordAnswers => canRecordAnswers($permissionLevel, $set->open_date, $set->due_date, |
209 | recordAnswers => canRecordAnswers($permissionLevel, $set->open_date, $set->due_date, |
| 210 | $problem->max_attempts, $problem->num_correct + $problem->num_incorrect + 1), |
210 | $problem->max_attempts, $problem->num_correct + $problem->num_incorrect + 1), |
| 211 | # attempts=num_correct+num_incorrect+1, as this happens before updating $problem |
211 | # attempts=num_correct+num_incorrect+1, as this happens before updating $problem |
| 212 | checkAnswers => canCheckAnswers($permissionLevel, $set->answer_date), |
212 | checkAnswers => canCheckAnswers($permissionLevel, $set->answer_date), |
| 213 | ); |
213 | ); |
|
|
214 | # more complicated logic for showing check answer button: |
|
|
215 | # checkAnswers button shows up after due date -- once a student can't record anymore |
|
|
216 | # checkAnswers button always shows up when an instructor or TA is acting |
|
|
217 | # as someone else (the $user and $effectiveUserName aren't the same). |
|
|
218 | $can{checkAnswers} = ($can{checkAnswers} && not $can{recordAnswers} ) || |
|
|
219 | ( $permissionLevel >= 5 and |
|
|
220 | defined($userName) and defined($effectiveUserName) and |
|
|
221 | ($userName ne $effectiveUserName) |
|
|
222 | ); |
|
|
223 | |
| 214 | |
224 | |
| 215 | # final values for options |
225 | # final values for options |
| 216 | my %will; |
226 | my %will; |
| 217 | foreach (keys %must) { |
227 | foreach (keys %must) { |
| 218 | $will{$_} = $can{$_} && ($want{$_} || $must{$_}); |
228 | $will{$_} = $can{$_} && ($want{$_} || $must{$_}); |
| … | |
… | |
| 518 | print $self->attemptResults($pg, $submitAnswers, |
528 | print $self->attemptResults($pg, $submitAnswers, |
| 519 | $will{showCorrectAnswers}, |
529 | $will{showCorrectAnswers}, |
| 520 | $pg->{flags}->{showPartialCorrectAnswers}, 1, 1); |
530 | $pg->{flags}->{showPartialCorrectAnswers}, 1, 1); |
| 521 | } elsif ($checkAnswers) { |
531 | } elsif ($checkAnswers) { |
| 522 | # print this if user previewed answers |
532 | # print this if user previewed answers |
|
|
533 | print "ANSWERS ONLY CHECKED -- ",CGI::br(),"ANSWERS NOT RECORDED", CGI::br(); |
| 523 | print $self->attemptResults($pg, 1, 0, 1, 1, 1); |
534 | print $self->attemptResults($pg, 1, 0, 1, 1, 1); |
| 524 | # show attempt answers |
535 | # show attempt answers |
| 525 | # don't show correct answers |
536 | # don't show correct answers |
| 526 | # show attempt results (correctness) |
537 | # show attempt results (correctness) |
| 527 | # don't show attempt previews |
538 | # don't show attempt previews |
| … | |
… | |
| 570 | -label=>"Preview Answers"), |
581 | -label=>"Preview Answers"), |
| 571 | ($can{recordAnswers} |
582 | ($can{recordAnswers} |
| 572 | ? CGI::submit(-name=>"submitAnswers", |
583 | ? CGI::submit(-name=>"submitAnswers", |
| 573 | -label=>"Submit Answers") |
584 | -label=>"Submit Answers") |
| 574 | : ""), |
585 | : ""), |
| 575 | ( ($can{checkAnswers} and not $can{recordAnswers}) |
586 | ( $can{checkAnswers} |
| 576 | ? CGI::submit(-name=>"checkAnswers", |
587 | ? CGI::submit(-name=>"checkAnswers", |
| 577 | -label=>"Check Answers") |
588 | -label=>"Check Answers") |
| 578 | : ""), |
589 | : ""), |
| 579 | ); |
590 | ); |
| 580 | print CGI::end_div(); |
591 | print CGI::end_div(); |