[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Fri, 22 Nov 2002 20:39:14 -0000
bowersj2 Fri Nov 22 15:39:14 2002 EDT
Modified files:
/loncom/interface lonquickgrades.pm
Log:
Now displays only sequences with problems in them, displays totals,
has help for "Max Possible To Date" to explain it, and has a
catchall "Problems not in Sequences" if there are problems directly
in the top-level sequence. Still may not be perfect but it should
be closer.
Also see (forthcoming) mail to the dev list.
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.5 loncom/interface/lonquickgrades.pm:1.6
--- loncom/interface/lonquickgrades.pm:1.5 Fri Nov 22 15:07:11 2002
+++ loncom/interface/lonquickgrades.pm Fri Nov 22 15:39:14 2002
@@ -156,6 +156,9 @@
my $indentString = ' ';
+ my $unaccountedTotal = $totalParts;
+ my $unaccountedCorrect = $totalRight;
+
# Second pass: Print the maps.
$r->print('<table cellspacing="3" border="2"><tr><td align="center"><b>Sequence</b></td>');
$r->print('<td align="center">Correct / Total</td><tr>' . "\n\n");
@@ -176,25 +179,38 @@
my $correct = $curRes->{DATA}->{CHILD_CORRECT};
my $total = $curRes->{DATA}->{CHILD_PARTS};
- my $ratio;
- $ratio = $total==0 ? 1 : $correct / $total;
- my $color = mixColors(\@start, \@end, $ratio);
- $r->print("<tr><td bgcolor='$color'>");
-
- for (my $i = 1; $i < $depth; $i++) { $r->print($indentString); }
+ $unaccountedTotal -= $total;
+ $unaccountedCorrect -= $correct;
- $r->print("<a href='$link'>$title</a></td>");
- $r->print("<td>$correct / $total</td></tr>\n");
+ if ($total > 0) {
+ my $ratio;
+ $ratio = $correct / $total;
+ my $color = mixColors(\@start, \@end, $ratio);
+ $r->print("<tr><td bgcolor='$color'>");
+
+ for (my $i = 1; $i < $depth; $i++) { $r->print($indentString); }
+
+ $r->print("<a href='$link'>$title</a></td>");
+ $r->print("<td align='center'>$correct / $total</td></tr>\n");
+ }
}
$curRes = $iterator->next();
}
+ # If there were any problems at the top level, print an extra "catchall"
+ if ($unaccountedTotal > 0) {
+ my $ratio = $unaccountedCorrect / $unaccountedTotal;
+ my $color = mixColors(\@start, \@end, $ratio);
+ $r->print("<tr><td bgcolor='$color'>");
+ $r->print("Problems Not Contained In Sequences</td><td align='center'>");
+ $r->print("$unaccountedCorrect / $unaccountedTotal</td></tr>");
+ }
- $r->print("\n</tr>\n\n");
+ my $maxHelpLink = Apache::loncommon::help_open_topic("Quick_Grades_Possibly_Correct");
$r->print("<tr><td colspan='2' align='right'>Total Parts Correct: <b>$totalRight</b><br>");
- $r->print("Number Of Parts Possibly Correct: <b>$totalPossible</b><br>");
+ $r->print("Max Possible To Date $maxHelpLink: <b>$totalPossible</b><br>");
$r->print("Total Parts In Course: <b>$totalParts</b></td></tr>\n\n");