[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm grades.pm imageresponse.pm response.pm /homework/caparesponse caparesponse.pm
raeburn
raeburn at source.lon-capa.org
Sun Nov 13 22:08:06 EST 2011
raeburn Mon Nov 14 03:08:06 2011 EDT
Modified files:
/loncom/homework grades.pm response.pm chemresponse.pm
imageresponse.pm
/loncom/homework/caparesponse caparesponse.pm
Log:
Using bubblesheets to record grades for handgraded exams
-- choose what filled last bubble represents (either a zero or max,
i.e., 5 for 5 bubbles per line, 10 for 10 bubbles per line etc.)
grades.pm
- New routine: &hand_bubble_option() determines if sequence to be graded
contains response types which are handgraded, and offers radio buttons to
choose score for last bubble.
response.pm
- &repetition() routine can be called in scalar context of in array context.
scalar: returns number of lines to encode weight
array: returns (number of lines to encode weight, bubbles/line).
chemresponse.pm imageresponse.pm caparesponse/caparesponse.pm
- &response::repetition() now explicitly called in scalar context.
Work in progress.
(Corresponding option needed in lonprintout.pm to set
correct number of bubble rows for handgraded questions with
weight >= bubbles per row).
-------------- next part --------------
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.662 loncom/homework/grades.pm:1.663
--- loncom/homework/grades.pm:1.662 Mon Oct 17 12:41:34 2011
+++ loncom/homework/grades.pm Mon Nov 14 03:08:01 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.662 2011/10/17 12:41:34 raeburn Exp $
+# $Id: grades.pm,v 1.663 2011/11/14 03:08:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6226,6 +6226,12 @@
'<tr><td><b>'.&mt('List of CODES to validate against:').'</b></td><td><tt>'.
$env{'form.scantron_CODElist'}.'</tt></td></tr>';
}
+ my $lastbubblepoints;
+ if ($env{'form.scantron_lastbubblepoints'} ne '') {
+ $lastbubblepoints =
+ '<tr><td><b>'.&mt('Hand-graded items: points from last bubble in row').'</b></td><td><tt>'.
+ $env{'form.scantron_lastbubblepoints'}.'</tt></td></tr>';
+ }
return ('
<p>
<span class="LC_warning">
@@ -6234,7 +6240,7 @@
<table>
<tr><td><b>'.&mt('Sequence to be Graded:').'</b></td><td>'.$title.'</td></tr>
<tr><td><b>'.&mt('Data File that will be used:').'</b></td><td><tt>'.$env{'form.scantron_selectfile'}.'</tt></td></tr>
-'.$CODElist.'
+'.$CODElist.$lastbubblepoints.'
</table>
<p> '.&mt('If this information is correct, please click on \'[_1]\'.',&mt($button_text)).'<br />
'.&mt('If something is incorrect, please return to [_1]Grade/Manage/Review Bubblesheets[_2] to start over.','<a href="/adm/grades?symb='.$symb.'&command=scantron_selectphase" class="LC_info">','</a>').'</p>
@@ -6272,8 +6278,9 @@
}
} else {
my $warning=&scantron_warning_screen('Grading: Validate Records',$symb);
+ my $bubbledbyhand=&hand_bubble_option();
$r->print('
-'.$warning.'
+'.$warning.$bubbledbyhand.'
<input type="submit" name="submit" value="'.&mt('Grading: Validate Records').'" />
<input type="hidden" name="command" value="scantron_validate" />
');
@@ -6369,6 +6376,9 @@
return '';
}
my $result=&scantron_form_start($max_bubble).$default_form_data;
+ if ($env{'form.scantron_lastbubblepoints'} ne '') {
+ $result .= '<input type="hidden" name="scantron_lastbubblepoints" value="'.$env{'form.scantron_lastbubblepoints'}.'" />';
+ }
$r->print($result);
my @validate_phases=( 'sequence',
@@ -7641,6 +7651,41 @@
return (0,$currentphase+1);
}
+sub hand_bubble_option {
+ my (undef, undef, $sequence) =
+ &Apache::lonnet::decode_symb($env{'form.selectpage'});
+ return if ($sequence eq '');
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ unless (ref($navmap)) {
+ return;
+ }
+ my $needs_hand_bubbles;
+ my $map=$navmap->getResourceByUrl($sequence);
+ my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
+ foreach my $res (@resources) {
+ if (ref($res)) {
+ if ($res->is_problem()) {
+ my $partlist = $res->parts();
+ foreach my $part (@{ $partlist }) {
+ my @types = $res->responseType($part);
+ if (grep(/^(chem|essay|image|formula|math|string|functionplot)$/, at types)) {
+ $needs_hand_bubbles = 1;
+ last;
+ }
+ }
+ }
+ }
+ }
+ if ($needs_hand_bubbles) {
+ my %scantron_config=&get_scantron_config($env{'form.scantron_format'});
+ my $bubbles_per_row = &bubblesheet_bubbles_per_row(\%scantron_config);
+ return &mt('The sequence to be graded contains response types which are handgraded.').'<p>'.
+ &mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?','<br />').
+ '<label><input type="radio" name="scantron_lastbubblepoints" value="'.$bubbles_per_row.'" checked="checked" />'.&mt('[quant,_1,point]',$bubbles_per_row).'</label> '.&mt('or').' '.
+ '<label><input type="radio" name="scantron_lastbubblepoints" value="0"/>0 points</label></p>';
+ }
+ return;
+}
sub scantron_process_students {
my ($r,$symb) = @_;
@@ -7932,6 +7977,9 @@
if ($bubbles_per_row ne '') {
$form{'bubbles_per_row'} = $bubbles_per_row;
}
+ if ($env{'form.scantron_lastbubblepoints'} ne '') {
+ $form{'scantron_lastbubblepoints'} = $env{'form.scantron_lastbubblepoints'};
+ }
if (ref($parts) eq 'HASH') {
if (ref($parts->{$ressymb}) eq 'ARRAY') {
foreach my $part (@{$parts->{$ressymb}}) {
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.226 loncom/homework/response.pm:1.227
--- loncom/homework/response.pm:1.226 Tue Sep 13 21:42:58 2011
+++ loncom/homework/response.pm Mon Nov 14 03:08:01 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.226 2011/09/13 21:42:58 raeburn Exp $
+# $Id: response.pm,v 1.227 2011/11/14 03:08:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -494,8 +494,8 @@
}
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
- &Apache::lonxml::increment_counter(&Apache::response::repetition(),
- "$part.$id");
+ my $repetition = &repetition();
+ &Apache::lonxml::increment_counter($repetition,"$part.$id");
if ($target eq 'analyze') {
$Apache::lonhomework::analyze{"$part.$id.type"} = 'customresponse';
&Apache::lonhomework::set_bubble_lines();
@@ -1034,12 +1034,18 @@
=item &repetition();
-Returns the number of lines that are required to encode the weight.
+In scalar context:
+
+returns: the number of lines that are required to encode the weight.
(Default is for 10 bubbles per bubblesheet item; other (integer)
values can be specified by using a custom Bubblesheet format file
with an eighteenth entry (BubblesPerRow) set to the integer
appropriate for the bubblesheets which will be used to assign weights.
+In array context:
+
+returns: number of lines required to encode weight, and bubbles/line.
+
=cut
sub repetition {
@@ -1053,9 +1059,18 @@
} else {
$bubbles_per_row = 10;
}
- my $repetition = int($weight/$bubbles_per_row);
- if ($weight % $bubbles_per_row != 0) { $repetition++; }
+ my $denominator = $bubbles_per_row;
+ if (($env{'form.scantron_lastbubblepoints'} == 0) &&
+ ($bubbles_per_row > 1)) {
+ $denominator = $bubbles_per_row - 1;
+ }
+ my $repetition = int($weight/$denominator);
+ if ($weight % $denominator != 0) { $repetition++; }
+ if (wantarray) {
+ return ($repetition,$bubbles_per_row);
+ }
return $repetition;
+
}
=pod
@@ -1085,11 +1100,24 @@
sub scored_response {
my ($part,$id)=@_;
my $repetition=&repetition();
+ my $bubbles_per_row;
+ if (($env{'form.bubbles_per_row'} =~ /^\d+$/) &&
+ ($env{'form.bubbles_per_row'} > 0)) {
+ $bubbles_per_row = $env{'form.bubbles_per_row'};
+ } else {
+ $bubbles_per_row = 10;
+ }
my $score=0;
for (my $i=0;$i<$repetition;$i++) {
- # A is 1, B is 2, etc. (get response return 0-9 and then we add 1)
+ # A is 1, B is 2, etc.
my $increase=&Apache::response::getresponse($i+1);
- if ($increase ne '') { $score+=$increase+1; }
+ unless (($increase == $bubbles_per_row-1) &&
+ ($env{'form.scantron_lastbubblepoints'} == 0)) {
+ # (get response return 0-9 and then we add 1)
+ if ($increase ne '') {
+ $score+=$increase+1;
+ }
+ }
}
my $weight = &Apache::lonnet::EXT("resource.$part.weight");
if (!defined($weight) || $weight eq '' || $weight eq 0) { $weight = 1; }
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.89 loncom/homework/chemresponse.pm:1.90
--- loncom/homework/chemresponse.pm:1.89 Mon Jul 4 09:24:54 2011
+++ loncom/homework/chemresponse.pm Mon Nov 14 03:08:01 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.89 2011/07/04 09:24:54 foxr Exp $
+# $Id: chemresponse.pm,v 1.90 2011/11/14 03:08:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -337,8 +337,8 @@
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
- &Apache::lonxml::increment_counter(&Apache::response::repetition(),
- "$partid.$id"); # part.response
+ my $repetition = &Apache::response::repetition();
+ &Apache::lonxml::increment_counter($repetition,"$partid.$id"); # part.response
if ($target eq 'analyze') {
$Apache::lonhomework::analyze{"$partid.$id.type"} = 'organicresponse';
push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
@@ -599,7 +599,8 @@
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
- &Apache::lonxml::increment_counter(&Apache::response::repetition(), "$partid.$id");
+ my $repetition = &Apache::response::repetition();
+ &Apache::lonxml::increment_counter($repetition,"$partid.$id");
if ($target eq 'analyze') {
$Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';
push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.102 loncom/homework/imageresponse.pm:1.103
--- loncom/homework/imageresponse.pm:1.102 Fri Sep 16 22:23:54 2011
+++ loncom/homework/imageresponse.pm Mon Nov 14 03:08:01 2011
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# image click response style
#
-# $Id: imageresponse.pm,v 1.102 2011/09/16 22:23:54 raeburn Exp $
+# $Id: imageresponse.pm,v 1.103 2011/11/14 03:08:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -179,7 +179,8 @@
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
- &Apache::lonxml::increment_counter(&Apache::response::repetition(),
+ my $repetition = &Apache::response::repetition();
+ &Apache::lonxml::increment_counter($repetition,
"$part_id.$response_id");
if ($target eq 'analyze') {
&Apache::lonhomework::set_bubble_lines();
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.248 loncom/homework/caparesponse/caparesponse.pm:1.249
--- loncom/homework/caparesponse/caparesponse.pm:1.248 Wed Jun 8 20:38:50 2011
+++ loncom/homework/caparesponse/caparesponse.pm Mon Nov 14 03:08:05 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.248 2011/06/08 20:38:50 www Exp $
+# $Id: caparesponse.pm,v 1.249 2011/11/14 03:08:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1389,8 +1389,8 @@
}
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
- &Apache::lonxml::increment_counter(&Apache::response::repetition(),
- "$part.$id");
+ my $repetition = &Apache::response::repetition();
+ &Apache::lonxml::increment_counter($repetition,"$part.$id");
if ($target eq 'analyze') {
&Apache::lonhomework::set_bubble_lines();
}
More information about the LON-CAPA-cvs
mailing list