version 1.123, 2005/08/02 18:05:25
|
version 1.125, 2005/09/23 16:47:06
|
Line 505 sub answer_part {
|
Line 505 sub answer_part {
|
my ($type,$answer) = @_; |
my ($type,$answer) = @_; |
my $result; |
my $result; |
if ($env{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
$result = ' \verb|'.$answer.'|\\\\ \hline '; |
my $to_use='|'; |
|
foreach my $value (32..126) { |
|
my $char=pack('c',$value); |
|
if ($answer !~ /\Q$char\E/) { |
|
$to_use=$char; |
|
last; |
|
} |
|
} |
|
$result = '\verb'.$to_use.$answer.$to_use.'\\\\ \hline '; |
} else { |
} else { |
$result = '<td>'.$answer.'</td>'; |
$result = '<td>'.$answer.'</td>'; |
} |
} |
Line 574 sub repetition {
|
Line 582 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/9; |
my $repetition = int($weight/10); |
if ($weight % 9 != 0) {$repetition++;} |
if ($weight % 10 != 0) { $repetition++; } |
return $repetition; |
return $repetition; |
} |
} |
|
|
Line 584 sub scored_response {
|
Line 592 sub scored_response {
|
my $repetition=&repetition(); |
my $repetition=&repetition(); |
my $score=0; |
my $score=0; |
for (my $i=0;$i<$repetition;$i++) { |
for (my $i=0;$i<$repetition;$i++) { |
|
# A is 1, B is 2, etc. (get response return 0-9 and then we add 1) |
my $increase=&Apache::response::getresponse($i+1); |
my $increase=&Apache::response::getresponse($i+1); |
if ($increase ne '') { $score+=$increase+1; } |
if ($increase ne '') { $score+=$increase+1; } |
} |
} |