Diff for /loncom/homework/response.pm between versions 1.225 and 1.226

version 1.225, 2011/09/08 01:18:15 version 1.226, 2011/09/13 21:42:58
Line 1003  sub getresponse { Line 1003  sub getresponse {
  $Apache::lonhomework::results{"resource.$part.$id.scantron"}.=   $Apache::lonhomework::results{"resource.$part.$id.scantron"}.=
     $response;      $response;
  if ($resulttype ne 'letter') {   if ($resulttype ne 'letter') {
     if ($resulttype eq 'A is 1') {              $response = $let_to_num{$response};
  $response = $let_to_num{$response}+1;              if ($resulttype eq 'A is 1') {
     } else {                  if ($response ne "") {
  $response = $let_to_num{$response};                      $response = $response+1;
                   }
     }      }
     if ($response ne "") {      if ($response ne "") {
  $response += $line * $bubbles_per_line;   $response += $line * $bubbles_per_line;
     }      }
  } else {   } else {
     if ($response ne "") {      if ($response ne "") {
                   my $raw = $response;
  $response = chr(ord($response) + $line * $bubbles_per_line);   $response = chr(ord($response) + $line * $bubbles_per_line);
     }      }
  }   }
Line 1033  sub getresponse { Line 1035  sub getresponse {
 =item &repetition();  =item &repetition();
   
 Returns the number of lines that are required to encode the weight.  Returns the number of lines that are required to encode the weight.
 (Currently expects that there are 10 bubbles per line)  (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.
   
 =cut  =cut
   
Line 1041  sub repetition { Line 1046  sub repetition {
     my $id = $Apache::inputtags::part;      my $id = $Apache::inputtags::part;
     my $weight = &Apache::lonnet::EXT("resource.$id.weight");      my $weight = &Apache::lonnet::EXT("resource.$id.weight");
     if (!defined($weight) || ($weight eq '')) { $weight=1; }      if (!defined($weight) || ($weight eq '')) { $weight=1; }
     my $repetition = int($weight/10);      my $bubbles_per_row;
     if ($weight % 10 != 0) { $repetition++; }       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 $repetition = int($weight/$bubbles_per_row);
       if ($weight % $bubbles_per_row != 0) { $repetition++; } 
     return $repetition;      return $repetition;
 }  }
   

Removed from v.1.225  
changed lines
  Added in v.1.226


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>