The following code makes a valiant attempt to do so, however. It tires to reproduce the message the student would normally get, but minus the score information unless the problem is fully correct (and the answer is being submitted). Add it at the bottom of your problem file.
install_problem_grader(sub { my ($result,$state) = std_problem_grader(@_); my $time = time(); my $open = $time >= $openDate && $time <= $dueDate; my $submit = $inputs_ref->{submitAnswers}; my $attempts = $state->{num_of_correct_ans} + $state->{num_of_incorrect_ans}; $attempts-- if $attempts && !$submit; my @msg = (); push(@msg,"Your score was ".($open ? "" : "not "). "recorded.") if $submit; push(@msg,"You have attempted this problem $attempts time".($attempts == 1 ? "." : "s.")); if ($submit) { if ($result->{score} == 1) { push(@msg,"You received a score of 100% for this attempt."); push(@msg,"Your overall recorded score is 100%."); } else { push(@msg,"Your answers are not yet fully correct."); } } unless ($open) { push(@msg,"The homework set is not yet open.") if $time < $openDate; push(@msg,"The homework set is closed.") if $time > $dueDate; } $state->{state_summary_msg} = join('<br>',@msg); return ($result,$state); });
This installs a custom grader that first calls the std_problem_grader (which I assume is the one you are using in order to suppress the correct/incorrect messages). It then attempts to create the new message section based on the (incomplete) data that it has. For example, it doesn't know the number of attempts remaining, so can't give that message if the problem has been set to allow only limited attempts.
Note, however, that the problem list page will still show the student's score, so it is still possible (though much less convenient) to find out if the student has received partial credit for an answer.
Hope that helps.
Davide
unless ($open) {
push(@msg,"The homework set is not yet open.") if $time $dueDate;
}
Is there something else I should be calling to get that information?
Nevertheless, when I commented out those lines, it worked nicely.
The problem set will open as soon as I get it ready, so it's not really an issue for me now, but it'd be nice to know how to fix this later.
Thanks again...
I have edited the code in the problem to take care of those issues, so try copying it again.
Davide
Another question: is it possible to turn off the
message until all parts of a question have been answered? As it is, if there are several parts to the problem (involving numerical or analytic answers) and one part is a multiple choice like
B. Diverge
then they can only answer this part and, if they get the message above, they know to pick the other answer.
In the meantime, you can try the following code. WeBWorK does give you control over that message, but again, it is not really very convenient to change it. For example, you have to include all the HTML by hand.
install_problem_grader(sub { my ($result,$state) = std_problem_grader(@_); $result->{summary} = '<DIV CLASS="ResultsWithError">Not all the answers above are correct.</DIV>' unless $result->{score} == 1; return ($result,$state); });
This example puts up the message whenever ANY answer is incorrect, including blank answers, so the student will get this until all the answers are correct. This also kills the warning about some answers not being provided. That could be handled, but it would take some work (you'd have to go through the answers to count the blank ones by hand, and I doubt it is worth it).
You can integrate this with the previous example (by copying the line that sets the result's summary), but I will lave that to you.
Davide