--- loncom/interface/lonquickgrades.pm 2011/05/25 01:12:01 1.92
+++ loncom/interface/lonquickgrades.pm 2011/05/26 18:02:22 1.93
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.92 2011/05/25 01:12:01 www Exp $
+# $Id: lonquickgrades.pm,v 1.93 2011/05/26 18:02:22 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -478,6 +478,33 @@ sub outputCategories {
# foreach (keys(%data)) {
# $r->print("\n
".$_.'='.$data{$_});
# }
+# my @debugarray=('5:1','4:3','1:1','5:5','6:7');
+# $r->print("Array: ".join(',',@debugarray).'
');
+# $r->print("0,0,0: ".join(',',&drop(0,0,0,@debugarray)).'
');
+# $r->print("1,0,0: ".join(',',&drop(1,0,0,@debugarray)).'
');
+# $r->print("0,1,0: ".join(',',&drop(0,1,0,@debugarray)).'
');
+# $r->print("1,1,0: ".join(',',&drop(1,1,0,@debugarray)).'
');
+#
+# $r->print("0,0,2: ".join(',',&drop(0,0,2,@debugarray)).'
');
+# $r->print("1,0,2: ".join(',',&drop(1,0,2,@debugarray)).'
');
+# $r->print("0,1,2: ".join(',',&drop(0,1,2,@debugarray)).'
');
+# $r->print("1,1,2: ".join(',',&drop(1,1,2,@debugarray)).'
');
+#
+# $r->print("0,0,4: ".join(',',&drop(0,0,4,@debugarray)).'
');
+# $r->print("1,0,4: ".join(',',&drop(1,0,4,@debugarray)).'
');
+# $r->print("0,1,4: ".join(',',&drop(0,1,4,@debugarray)).'
');
+# $r->print("1,1,4: ".join(',',&drop(1,1,4,@debugarray)).'
');
+#
+# $r->print("0,0,5: ".join(',',&drop(0,0,5,@debugarray)).'
');
+# $r->print("1,0,5: ".join(',',&drop(1,0,5,@debugarray)).'
');
+# $r->print("0,1,5: ".join(',',&drop(0,1,5,@debugarray)).'
');
+# $r->print("1,1,5: ".join(',',&drop(1,1,5,@debugarray)).'
');
+#
+# $r->print("0,0,7: ".join(',',&drop(0,0,7,@debugarray)).'
');
+# $r->print("1,0,7: ".join(',',&drop(1,0,7,@debugarray)).'
');
+# $r->print("0,1,7: ".join(',',&drop(0,1,7,@debugarray)).'
');
+# $r->print("1,1,7: ".join(',',&drop(1,1,7,@debugarray)).'
');
+
}
#
@@ -775,7 +802,7 @@ ENDMOVE
#
sub drop {
- my ($high,$percent,@individual)=@_;
+ my ($high,$percent,$n,@individual)=@_;
my @newindividual=sort {
my ($pa,$ca)=split(/\:/,$a);
my ($pb,$cb)=split(/\:/,$b);
@@ -789,7 +816,19 @@ sub drop {
$ca<=>$cb;
}
} @individual;
+ if ($#newindividual>=$n) {
+ if ($high) {
+ splice(@newindividual,$#newindividual+1-$n,$n);
+ } else {
+ splice(@newindividual,0,$n);
+ }
+ } else {
+ @newindividual=();
+ }
my $newcorrect=0;
+ for my $score (@newindividual) {
+ $newcorrect+=(split(/\:/,$score))[1];
+ }
return ($newcorrect,@newindividual);
}
#