'.&mt('Total raw points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
if ($cangrade) {
$r->print(' '.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).' ');
}
+ $r->print('
'.&mt('Total raw points: [_1]/[_2]',&numberout($totalcorrect),&numberout($totalpossible)).'
');
$r->print('');
}
# Total
@@ -692,12 +711,11 @@ 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)).'
');
}
# Calculation
- my $actualtotal=$totalcorrect;
if ($output) { $r->print('
'); }
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) {
if ($output) { $r->print('
');
+# Re-adjust total points if force total
+ if ($categories{$id.'_totaltype'} eq 'typein') {
+ $totalpossible=1.*$categories{$id.'_total'};
}
- if ($cangrade) {
- if ($output) { $r->print(' '.&new_calc_rule_form($id)); }
+ if ($output) {
+ $r->print('');
+ if ($cangrade) { $r->print(' '.&new_calc_rule_form($id)); }
+ $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);
}
#
+# Drop folders and problems
+#
+
+sub drop {
+ my ($high,$percent,$n,@individual)=@_;
+# Sort assignments by points or percent
+ my @newindividual=sort {
+ my ($pa,$ca)=split(/\:/,$a);
+ my ($pb,$cb)=split(/\:/,$b);
+ if ($percent) {
+ my $perca=0;
+ if ($pa>0) { $perca=$ca/$pa; }
+ my $percb=0;
+ if ($pb>0) { $percb=$cb/$pb; }
+ $perca<=>$percb;
+ } else {
+ $ca<=>$cb;
+ }
+ } @individual;
+# Drop the ones we don't want
+ if ($#newindividual>=$n) {
+ if ($high) {
+ splice(@newindividual,$#newindividual+1-$n,$n);
+ } else {
+ splice(@newindividual,0,$n);
+ }
+ } else {
+ @newindividual=();
+ }
+# Re-calculate how many points possible and achieved
+ my $newpossible=0;
+ my $newcorrect=0;
+ for my $score (@newindividual) {
+ my ($thispossible,$thiscorrect)=(split(/\:/,$score));
+ $newpossible+=$thispossible;
+ $newcorrect+=$thiscorrect;
+ }
+ return ($newpossible,$newcorrect,@newindividual);
+}
+#
# Bottom line with grades
#
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('