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

version 1.223, 2011/06/06 17:17:38 version 1.226, 2011/09/13 21:42:58
Line 179  sub setrandomnumber { Line 179  sub setrandomnumber {
     } else {      } else {
  ($rndmod,$rndmod2)=&Apache::lonnet::digest("$id1,$id2");   ($rndmod,$rndmod2)=&Apache::lonnet::digest("$id1,$id2");
     }      }
       $Apache::lonhomework::results{'resource.'.$id1.'.rawrndseed'}=$rndseed;
     if ($rndseed =~/([,:])/) {      if ($rndseed =~/([,:])/) {
  my $char=$1;   my $char=$1;
  use integer;   use integer;
Line 322  sub check_for_previous { Line 322  sub check_for_previous {
                         next if (($questiontype eq 'randomizetry') &&                          next if (($questiontype eq 'randomizetry') &&
                              ($curr_rndseed ne $Apache::lonhomework::history{"$history:resource.$partid.rndseed"}));                               ($curr_rndseed ne $Apache::lonhomework::history{"$history:resource.$partid.rndseed"}));
                         push (@{$previous{'versionci'}},$history);                          push (@{$previous{'versionci'}},$history);
                         $previous{'awardci'} = $Apache::lonhomework::history{"resource.$partid.$id.awarddetail"};                          $previous{'awardci'} = $Apache::lonhomework::history{"$history:resource.$partid.$id.awarddetail"};
                         $previous{'usedci'} = 1;                          $previous{'usedci'} = 1;
                     }                      }
                 }                  }
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.223  
changed lines
  Added in v.1.226


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