@@ -682,7 +687,7 @@ ENDMOVE
if ($possible>0) { push(@individual,"$possible:$correct"); }
if ($output) {
$r->print('
');
- $r->print(&Apache::lonnet::gettitle($contentid).' ('.$correct.'/'.$possible.')');
+ $r->print(&Apache::lonnet::gettitle($contentid).' ('.&numberout($correct).'/'.&numberout($possible).')');
if ($cangrade) {
$r->print(' '.&mt('Delete').'');
}
@@ -694,7 +699,7 @@ ENDMOVE
if ($cangrade) {
$r->print('
'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'
');
}
- $r->print(''.&mt('Total raw points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
+ $r->print(''.&mt('Total raw points: [_1]/[_2]',&numberout($totalcorrect),&numberout($totalpossible)).'
');
$r->print('');
}
# Total
@@ -719,7 +724,7 @@ ENDMOVE
$totalpossible=1.*$categories{$id.'_total'};
}
if ($output) {
- $r->print(''.&mt('Adjusted raw points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
+ $r->print(''.&mt('Adjusted raw points: [_1]/[_2]',&numberout($totalcorrect),&numberout($totalpossible)).'
');
}
@@ -763,43 +768,54 @@ ENDMOVE
if ($output) {
$r->print('');
if ($cangrade) { $r->print('
'.&new_calc_rule_form($id)); }
- $r->print(''.&mt('Calculated points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
+ $r->print(''.&mt('Calculated points: [_1]/[_2]',&numberout($totalcorrect),&numberout($totalpossible)).'
');
$r->print('');
}
-
+#
+# Prepare for export
+#
# Weight
+ my $weight=$categories{$id.'_weight'};
+ unless (1.*$weight>0) { $weight=0; }
if ($cangrade) {
if ($output) {
$r->print(''.
' | ');
+ '" value="'.&Apache::lonhtmlcommon::entity_encode($weight).'" />');
}
} else {
if ($output) {
- $r->print(''.$categories{$id.'_weight'}.' | ');
+ $r->print(''.$weight.' | ');
}
}
# Achieved
+ my $type=$categories{$id.'_displayachieved'};
+ unless (($type eq 'percent') || ($type eq 'points')) { $type='points'; }
if ($output) { $r->print(''); }
if ($cangrade) {
if ($output) {
$r->print('');
}
- } else {
- if ($output) {
- if ($categories{$id.'_displayachieved'} eq 'percent') {
- $r->print(&mt('percent'));
- } else {
- $r->print(&mt('points'));
+ }
+ if ($output) {
+ $r->print(' ');
+ if ($type eq 'percent') {
+ my $perc='---';
+ if ($totalpossible) {
+ $perc=100.*$totalcorrect/$totalpossible;
}
+ $r->print(&mt('[_1] percent',&numberout($perc)));
+ } else {
+ $r->print(&mt('[_1]/[_2] points',&numberout($totalcorrect),&numberout($totalpossible)));
}
+ $r->print(' ');
}
if ($output) { $r->print(' | '); }
- return ($value,$weight);
+ return ($totalcorrect,$totalpossible,$type,$weight);
}
#
@@ -847,14 +863,21 @@ sub drop {
#
sub bottom_line_category {
- my ($r,$cangrade,$sum,$total)=@_;
+ my ($r,$cangrade,$perc)=@_;
$r->print(&Apache::loncommon::start_data_table_row());
if ($cangrade) {
$r->print(''.&mt('Create New Category').' | ');
}
- $r->print(''.&mt('Current:').$sum.' '.&mt('Total:').$total.'
| ');
+ $r->print(''.&mt('Total: [_1] percent',&numberout($perc)).' | ');
}
+sub numberout {
+ my ($number)=@_;
+ my $printout=sprintf("%.3f", $number);
+ $printout=~s/0+$//;
+ $printout=~s/\.$//;
+ return $printout;
+}
#
# Make one new category
#