--- loncom/interface/lonquickgrades.pm 2011/05/24 17:17:24 1.89
+++ loncom/interface/lonquickgrades.pm 2011/05/25 01:12:01 1.92
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.89 2011/05/24 17:17:24 www Exp $
+# $Id: lonquickgrades.pm,v 1.92 2011/05/25 01:12:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -646,11 +646,13 @@ ENDMOVE
# Content display and summing up of points
my $totalpossible=0;
my $totalcorrect=0;
+ my @individual=();
if ($output) { $r->print('
'); }
foreach my $contentid (split(/\,/,$categories{$id.'_content'})) {
my ($type,$possible,$attempted,$correct)=split(/\:/,$$performance{$contentid});
$totalpossible+=$possible;
$totalcorrect+=$correct;
+ if ($possible>0) { push(@individual,"$possible:$correct"); }
if ($output) {
$r->print('');
$r->print(&Apache::lonnet::gettitle($contentid).' ('.$correct.'/'.$possible.')');
@@ -662,28 +664,36 @@ ENDMOVE
}
if ($output) {
$r->print(' ');
- $r->print(''.&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]',$totalcorrect,$totalpossible).'
');
$r->print(' ');
}
# Total
+ if ($output) { $r->print(''); }
if ($cangrade) {
if ($output) {
- $r->print(' '.
+ $r->print(
''.
''.&mt('default').' '.
''.&mt('Type-in value').' '.
' '.
' ');
+ '" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_total'}).'" />');
}
} else {
if ($output) {
- $r->print(''.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).' ');
+ $r->print(''.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}));
}
}
+# Adjust total points
+ if ($categories{$id.'_totaltype'} eq 'typein') {
+ $totalpossible=1.*$categories{$id.'_total'};
+ }
+ if ($output) {
+ $r->print(''.&mt('Adjusted raw points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
+ }
# Calculation
@@ -695,13 +705,35 @@ ENDMOVE
if ($cangrade) {
if ($output) { $r->print(' '.&mt('Delete').' '); }
}
+ if ($code eq 'capabove') {
+ if ($totalpossible>0) {
+ if ($totalcorrect/$totalpossible>$value/100.) {
+ $totalcorrect=$totalpossible*$value/100.;
+ }
+ }
+ } elsif ($code eq 'capbelow') {
+ if ($totalpossible>0) {
+ if ($totalcorrect/$totalpossible<$value/100.) {
+ $totalcorrect=$totalpossible*$value/100.;
+ }
+ }
+ } elsif ($code eq 'droplow') {
+ ($totalcorrect,@individual)=&drop(0,0,$value,@individual);
+ } elsif ($code eq 'drophigh') {
+ ($totalcorrect,@individual)=&drop(1,0,$value,@individual);
+ } elsif ($code eq 'droplowperc') {
+ ($totalcorrect,@individual)=&drop(0,1,$value,@individual);
+ } elsif ($code eq 'drophighperc') {
+ ($totalcorrect,@individual)=&drop(1,1,$value,@individual);
+ }
if ($output) { $r->print(''); }
}
- if ($output) { $r->print(''); }
- 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(''.&mt('Calculated points: [_1]/[_2]',$totalcorrect,$totalpossible).'
');
+ $r->print(' ');
}
- if ($output) { $r->print(''); }
# Weight
if ($cangrade) {
@@ -739,6 +771,28 @@ ENDMOVE
}
#
+# Drop folders and problems
+#
+
+sub drop {
+ my ($high,$percent,@individual)=@_;
+ 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;
+ my $newcorrect=0;
+ return ($newcorrect,@newindividual);
+}
+#
# Bottom line with grades
#
@@ -781,8 +835,10 @@ sub make_new_category {
sub category_rule_codes {
return &Apache::lonlocal::texthash(
- 'droplow' => 'Drop N lowest grade assignments',
- 'drophigh' => 'Drop N highest grade assignments',
+ 'droplowperc' => 'Drop N lowest grade percentage problems/folders',
+ 'drophighperc' => 'Drop N highest grade percentage problems/folderss',
+ 'droplow' => 'Drop N lowest point problems/folders',
+ 'drophigh' => 'Drop N highest point problems/folders',
'capabove' => 'Cap percentage above N percent',
'capbelow' => 'Cap percentage below N percent');
}