Skip to content

Commit dea814e

Browse files
authored
Merge pull request #1233 from dlglin/remove0_60_100
Remove 0_60_100 grader
2 parents 2b48ef9 + 1b244ed commit dea814e

File tree

1 file changed

+4
-76
lines changed

1 file changed

+4
-76
lines changed

macros/core/PGgraders.pl

Lines changed: 4 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -59,90 +59,18 @@ sub full_partial_grader {
5959
return ($rh_problem_result, $rh_problem_state);
6060
}
6161

62-
=head2 custom_problem_grader_0_60_100
63-
64-
We need a special problem grader on this problem, since we
65-
want the student to get full credit for all five answers correct,
66-
60% credit for four correct, and 0% for three or fewer correct.
67-
To change this scheme, look through the following mess of code
68-
for the place where the variable $numright appears, and change
69-
that part.
70-
Also change the long line beginning "msg ==>", to show what will
71-
appear on the screen for the student.
72-
73-
To look at the problem itself, look for the boxed comment below
74-
announcing the problem itself.
75-
76-
=cut
77-
78-
sub custom_problem_grader_0_60_100 {
79-
my ($rh_evaluated_answers, $rh_problem_state, %form_options) = @_;
80-
81-
my %evaluated_answers = %{$rh_evaluated_answers};
82-
83-
# By default the old problem state is simply passed back out again.
84-
my %problem_state = %$rh_problem_state;
85-
86-
# Initial setup of the answer
87-
my $total = 0;
88-
my %problem_result = (
89-
score => 0,
90-
errors => '',
91-
type => 'custom_problem_grader',
92-
msg => 'To get full credit, all answers must be correct. Having '
93-
. 'all but one correct is worth 60%. Two or more incorrect answers gives a score of 0%.',
94-
);
95-
96-
# Return unless answers have been submitted
97-
return (\%problem_result, \%problem_state) unless $form_options{answers_submitted} == 1;
98-
99-
# Answers have been submitted -- process them.
100-
101-
# Compute the score. The variable $numright is the number of correct answers.
102-
my $numright = 0;
103-
104-
$numright += $evaluated_answers{'AnSwEr0001'}{score};
105-
$numright += $evaluated_answers{'AnSwEr0002'}{score};
106-
$numright += $evaluated_answers{'AnSwEr0003'}{score};
107-
$numright += $evaluated_answers{'AnSwEr0004'}{score};
108-
$numright += $evaluated_answers{'AnSwEr0005'}{score};
109-
110-
if ($numright == 5) {
111-
$total = 1;
112-
} elsif ($numright == 4) {
113-
$total = 0.6;
114-
} else {
115-
$total = 0;
116-
}
117-
118-
$problem_result{score} = $total;
119-
$problem_state{recorded_score} //= 0;
120-
121-
# Increase recorded score if the current score is greater.
122-
$problem_state{recorded_score} = $problem_result{score} if $problem_result{score} > $problem_state{recorded_score};
123-
124-
++$problem_state{num_of_correct_ans} if $total == 1;
125-
++$problem_state{num_of_incorrect_ans} if $total < 1;
126-
127-
return (\%problem_result, \%problem_state);
128-
}
129-
13062
=head2 custom_problem_grader_fluid
13163
13264
This problem grader custom_problem_grader_fluid
13365
was contributed by Prof. Zig Fiedorowicz,
13466
Dept. of Mathematics, Ohio State University on 8/25/01.
135-
As written, the problem grader should be put in a separate macro file.
136-
If actually inserted into a problem, you need to replace a couple
137-
of backslashes by double tildes.
13867
139-
This is a generalization of the previous custom grader.
14068
This grader expects two array references to be passed to it, eg.
141-
$ENV['grader_numright'] = [2,5,7,10];
142-
$ENV['grader_scores'] = [0.1,0.4,0.6,1]
69+
$ENV{'grader_numright'} = [2,5,7,10];
70+
$ENV{'grader_scores'} = [0.1,0.4,0.6,1]
14371
Both arrays should be of the same length, and in strictly
144-
increasing order. The first array is an array of possible
145-
raw scores, the number of parts of the problem the student might
72+
increasing order. The first array is an array of non-negative
73+
integers: the number of parts of the problem the student might
14674
get right. The second array is the corresponding array of scores
14775
the student would be credited with for getting that many parts
14876
right. The scores should be real numbers between 0 and 1.

0 commit comments

Comments
 (0)