[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm grades.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 06 Feb 2008 16:32:32 -0000


raeburn		Wed Feb  6 11:32:32 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm chemresponse.pm 
  Log:
  - imageresponse, reactionresponse and organicresponse behave the same way as essayresponse.  When used in an exam the number of bubble lines per problem part depends on the weight assigned to the part.
  - Part Ids for reactionresponse and organicresponse are not contained in $analysis{'parts'} from lonnet::ssi, so they need to be retrieved from the resource object.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.509 loncom/homework/grades.pm:1.510
--- loncom/homework/grades.pm:1.509	Tue Feb  5 19:39:11 2008
+++ loncom/homework/grades.pm	Wed Feb  6 11:32:30 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.509 2008/02/06 00:39:11 raeburn Exp $
+# $Id: grades.pm,v 1.510 2008/02/06 16:32:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5458,7 +5458,10 @@
     my $occurrences = 0;
     if (($responsetype_per_response{$questnum-1} eq 'essayresponse') ||
         ($responsetype_per_response{$questnum-1} eq 'formularesponse') ||
-        ($responsetype_per_response{$questnum-1} eq 'stringresponse')) {
+        ($responsetype_per_response{$questnum-1} eq 'stringresponse') ||
+        ($responsetype_per_response{$questnum-1} eq 'imageresponse') ||
+        ($responsetype_per_response{$questnum-1} eq 'reactionresponse') ||
+        ($responsetype_per_response{$questnum-1} eq 'organicresponse')) {
         my @singlelines = split('',$currquest);
         foreach my $entry (@singlelines) {
             $occurrences = &occurence_count($entry,$matchon);
@@ -5557,7 +5560,10 @@
         #
         if (($responsetype_per_response{$questnum-1} eq 'essayresponse') ||
             ($responsetype_per_response{$questnum-1} eq 'formularesponse') ||
-            ($responsetype_per_response{$questnum-1} eq 'stringresponse')) {
+            ($responsetype_per_response{$questnum-1} eq 'stringresponse') ||
+            ($responsetype_per_response{$questnum-1} eq 'imageresponse') ||
+            ($responsetype_per_response{$questnum-1} eq 'reactionresponse') ||
+            ($responsetype_per_response{$questnum-1} eq 'organicresponse')) {
             my $doubleerror = 0;
             while (($currquest >= $$scantron_config{'Qlength'}) && 
                    (!$doubleerror)) {
@@ -6798,8 +6804,9 @@
                                   in exam mode. This hash contains a 
                                   comma-separated list of the lines per 
                                   sub-question.
-   %responsetype_per_response   - essayresponse, forumalaresponse, and
-                                  stringresponse type problem parts can have
+   %responsetype_per_response   - essayresponse, formularesponse,
+                                  stringresponse, imageresponse, reactionresponse,
+                                  and organicresponse type problem parts can have
                                   multiple lines per response if the weight
                                   assigned exceeds 10.  In this case, only
                                   one bubble per line is permitted, but more 
@@ -6833,7 +6840,10 @@
         $r->print(&mt('The group of bubble lines below responds to a single question.').'<br />');
         if (($responsetype_per_response{$question-1} eq 'essayresponse') ||
             ($responsetype_per_response{$question-1} eq 'formularesponse') ||
-            ($responsetype_per_response{$question-1} eq 'stringresponse')) {
+            ($responsetype_per_response{$question-1} eq 'stringresponse') ||
+            ($responsetype_per_response{$question-1} eq 'imageresponse') ||
+            ($responsetype_per_response{$question-1} eq 'reactionresponse') ||
+            ($responsetype_per_response{$question-1} eq 'organicresponse')) {
             $r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the exam directed students to leave [quant,_1,line] blank on their scantron sheets.",$lines).'<br /><br />'.&mt('A non-zero score can be assigned to the student during scantron grading by selecting a bubble in at least one line.').'<br />'.&mt('The score for this question will be a sum of the numeric values for the selected bubbles from each line, where A=1 point, B=2 points etc.').'<br />'.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").'<br /><br />');
         } else {
             $r->print(&mt("Select at most one bubble in a single line and select 'No Bubble' in all the other lines. ")."<br />");
@@ -7146,8 +7156,9 @@
     my $response_number = 0;
     my $bubble_line     = 0;
     foreach my $resource (@resources) {
-        # Need to retrieve part IDs and response IDs because essayresponse
-        # items are not included in $analysis{'parts'} from lonnet::ssi.  
+        # Need to retrieve part IDs and response IDs because essayresponse,
+        # reactionresponse and organicresponse items are not included in 
+        # $analysis{'parts'} from lonnet::ssi.  
         my %possible_part_ids; 
         if (ref($resource->parts()) eq 'ARRAY') { 
             foreach my $part (@{$resource->parts()}) {
@@ -7175,7 +7186,9 @@
         }
         # Add part_ids for any essayresponse items. 
         foreach my $part_id (keys(%possible_part_ids)) {
-            if ($analysis{$part_id.'.type'} eq 'essayresponse') {
+            if (($analysis{$part_id.'.type'} eq 'essayresponse') ||
+                ($analysis{$part_id.'.type'} eq 'reactionresponse') ||
+                ($analysis{$part_id.'.type'} eq 'organicresponse')) {
                 if (!grep(/^\Q$part_id\E$/,@parts)) {
                     push (@parts,$part_id);
                 }
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.76 loncom/homework/chemresponse.pm:1.77
--- loncom/homework/chemresponse.pm:1.76	Fri Feb  1 17:05:45 2008
+++ loncom/homework/chemresponse.pm	Wed Feb  6 11:32:30 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.76 2008/02/01 22:05:45 raeburn Exp $
+# $Id: chemresponse.pm,v 1.77 2008/02/06 16:32:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -566,6 +566,10 @@
     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");
+        if ($target eq 'analyze') {
+            $Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';
+            &Apache::lonhomework::set_bubble_lines();
+        }
     }
     &Apache::response::end_response();
     return $result;