[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm
www
www@source.lon-capa.org
Wed, 01 Jun 2011 21:32:50 -0000
www Wed Jun 1 21:32:50 2011 EDT
Modified files:
/loncom/interface lonquickgrades.pm
Log:
Slight optimization (10%)
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.96 loncom/interface/lonquickgrades.pm:1.97
--- loncom/interface/lonquickgrades.pm:1.96 Wed Jun 1 20:32:30 2011
+++ loncom/interface/lonquickgrades.pm Wed Jun 1 21:32:50 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.96 2011/06/01 20:32:30 www Exp $
+# $Id: lonquickgrades.pm,v 1.97 2011/06/01 21:32:50 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -244,7 +244,9 @@
for my $part (@{$parts}) {
my $completionStatus = $curRes->getCompletionStatus($part);
my $dateStatus = $curRes->getDateStatus($part);
-
+ my $weight = $curRes->weight($part);
+ my $problemstatus = $curRes->problemstatus($part);
+
if ($completionStatus == $curRes->EXCUSED()) {
next;
}
@@ -252,29 +254,29 @@
my $score = 0;
# If we're not telling status and the answer date isn't passed yet,
# it's an "attempted" point
- if ((($curRes->problemstatus($part) eq 'no') ||
- ($curRes->problemstatus($part) eq 'no_feedback_ever')) &&
+ if ((($problemstatus eq 'no') ||
+ ($problemstatus eq 'no_feedback_ever')) &&
($dateStatus != $curRes->ANSWER_OPEN)) {
my $status = $curRes->simpleStatus($part);
if ($status == $curRes->ATTEMPTED) {
- $partsAttempted += $curRes->weight($part);
+ $partsAttempted += $weight;
$totalAttempted += $partsAttempted;
}
} else {
- $score = &Apache::grades::compute_points($curRes->weight($part), $curRes->awarded($part));
+ $score = &Apache::grades::compute_points($weight, $curRes->awarded($part));
}
$partsRight += $score;
$totalRight += $score;
- $partsCount += $curRes->weight($part);
+ $partsCount += $weight;
$curRes->{DATA}->{PROB_SCORE} += $score;
- $curRes->{DATA}->{PROB_WEIGHT} += $curRes->weight($part);
+ $curRes->{DATA}->{PROB_WEIGHT} += $weight;
if ($curRes->opendate($part) < $now) {
- $totalPossible += $curRes->weight($part);
- $curRes->{DATA}->{PROB_POSSIBLE} += $curRes->weight($part);
+ $totalPossible += $weight;
+ $curRes->{DATA}->{PROB_POSSIBLE} += $weight;
}
- $totalParts += $curRes->weight($part);
+ $totalParts += $weight;
} else {
my $status = $curRes->simpleStatus($part);
my $thisright = 0;
@@ -291,7 +293,6 @@
$totalAttempted++;
}
- my $dateStatus = $curRes->getDateStatus($part);
$totalParts++;
if ($curRes->opendate($part) < $now) {
$totalPossible++;