[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm

www www@source.lon-capa.org
Tue, 24 May 2011 23:44:33 -0000


www		Tue May 24 23:44:33 2011 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
  Log:
  Implemented two calculation rules, added two more possible rules.
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.90 loncom/interface/lonquickgrades.pm:1.91
--- loncom/interface/lonquickgrades.pm:1.90	Tue May 24 18:06:10 2011
+++ loncom/interface/lonquickgrades.pm	Tue May 24 23:44:33 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.90 2011/05/24 18:06:10 www Exp $
+# $Id: lonquickgrades.pm,v 1.91 2011/05/24 23:44:33 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -646,11 +646,13 @@
 # Content display and summing up of points
     my $totalpossible=0;
     my $totalcorrect=0;
+    my @individual=();
     if ($output) { $r->print('<td><ul>'); }
     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('<li>');
            $r->print(&Apache::lonnet::gettitle($contentid).' ('.$correct.'/'.$possible.')');
@@ -695,6 +697,7 @@
 
 
 # Calculation
+    my $actualtotal=$totalcorrect;
     if ($output) { $r->print('<td><ul>'); }
     foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) {
         if ($output) { $r->print('<li>'); }
@@ -703,9 +706,26 @@
         if ($cangrade) {
            if ($output) { $r->print(' <a href="javascript:storecmd(\'delrule_'.$id.'______'.$code.'\');">'.&mt('Delete').'</a>'); }
         }
+        if ($code eq 'capabove') {
+            if ($totalpossible>0) {
+                if ($actualtotal/$totalpossible>$value/100.) {
+                    $actualtotal=$totalpossible*$value/100.;
+                }
+            }
+        } elsif ($code eq 'capbelow') {
+            if ($totalpossible>0) {
+                if ($actualtotal/$totalpossible<$value/100.) {
+                    $actualtotal=$totalpossible*$value/100.;
+                }
+            }
+        }
         if ($output) { $r->print('</li>'); }
     }
-    if ($output) { $r->print('</ul>'); }
+    if ($output) { 
+       $r->print('</ul>'); 
+       $r->print('<p>'.&mt('Calculated points: [_1]/[_2]',$actualtotal,$totalpossible).'</p>');
+    }
+
     if ($cangrade) {
         if ($output) { $r->print('<br />'.&new_calc_rule_form($id)); }
     }
@@ -789,8 +809,10 @@
 
 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');
 }