## WeBWorK Problems

### Hide partial credit percentages from students?

by Patti Lamm -
Number of replies: 6
I have a problem which has 2 multiple choice parts and one numerical answer part. The students cannot tell which part of the answer is correct from the preview, however if they try all of the multiple choice parts first and watch their "percentage correct" score at the bottom of the page, they can find the correct answer for the multiple choice partst. Is there a way to disable the "percent correct" displayed information on a problem until the problem is 100% correct, but still give partial credit in case the students don't get everything correct?

### Re: Hide partial credit percentages from students?

by Davide Cervone -
The problem grader has control over the message at the bottom of the problem, and can completely replace it, if it desires. Unfortunately, the grader doesn't have access to all the data that it needs to properly reconstruct the various parts of the message, so it is not really possible to just edit the message that would usually be there.

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 {
}
}
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

### Re: Hide partial credit percentages from students?

by Patti Lamm -
Thanks, David. I received eval errors for the variables $time and$dueDate in

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... In reply to Patti Lamm ### Re: Hide partial credit percentages from students? by Davide Cervone - Sorry, the less-than sign was lost in the editor (thinking it was part of an HTML tag), and it was lost up to a greater-than sign in the next line, so a whole line was lost in translation. There was another instance of that near the top of the problem as well. I have edited the code in the problem to take care of those issues, so try copying it again. Davide In reply to Davide Cervone ### Re: Hide partial credit percentages from students? by Patti Lamm - Thank you, that fixed the problem. Another question: is it possible to turn off the "At least one of your answers is incorrect" 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 A. Converge B. Diverge then they can only answer this part and, if they get the message above, they know to pick the other answer. In reply to Patti Lamm ### Re: Hide partial credit percentages from students? by Davide Cervone - You are correct that this leaks information. I will file a bug report to that effect. 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