--- loncom/interface/lonquickgrades.pm 2002/11/15 20:08:18 1.3 +++ loncom/interface/lonquickgrades.pm 2002/11/19 21:11:25 1.4 @@ -62,6 +62,29 @@ sub handler { $ENV{"request.course.fn"}.".db", $ENV{"request.course.fn"}."_parms.db", 1, 0); + # Keep this hash in sync with %statusIconMap in lonnavmaps; they + # should match color/icon + my $res = $navmap->firstResource(); # temp resource to access constants + + my $green = "#AAFFAA"; + my $red = "#FFAAAA"; + my $yellow = "#FFFFAA"; + my $orange = "#FFBB88"; + my $neutral = ""; + my %statusColorMap = + ( $res->NETWORK_FAILURE => $neutral, + $res->NOTHING_SET => $neutral, + $res->CORRECT => $green, + $res->EXCUSED => $green, + $res->PAST_DUE_NO_ANSWER => $orange, + $res->PAST_DUE_ANSWER_LATER => $orange, + $res->ANSWER_OPEN => $orange, + $res->OPEN_LATER => $neutral, + $res->TRIES_LEFT => $neutral, + $res->INCORRECT => $orange, + $res->OPEN => $yellow, + $res->ATTEMPTED => $yellow ); + if (!defined($navmap)) { my $requrl = $r->uri; $ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized"; @@ -76,21 +99,15 @@ sub handler { # End navmap using boilerplate - # Col labels - $r->print(< - - Problem - Score - -TABLETOP - my $iterator = $navmap->getIterator(undef, undef, undef, 1); my $depth = 1; $iterator->next(); # ignore first BEGIN_MAP my $curRes = $iterator->next(); - my $totalAvailable = 0; - my $total = 0; + my $totalParts = 0; + my $totalRight = 0; + my $totalCurrentlyPossible = 0; + + $r->print("
\n"); # use this to format the col while ( $depth > 0 ) { if ($curRes == $iterator->BEGIN_MAP()) {$depth++;} @@ -98,7 +115,6 @@ TABLETOP if (ref($curRes) && $curRes->is_problem()) { my $title = $curRes->compTitle(); - $r->print(' '); my $stack = $iterator->getStack(); my $src = Apache::lonnavmaps::getLinkForResource($stack); my $srcHasQuestion = $src =~ /\?/; @@ -106,29 +122,39 @@ TABLETOP ($srcHasQuestion?'&':'?') . 'symb='.&Apache::lonnet::escape($curRes->symb()). '"'; - $r->print("$title"); - - my $avail = 0; - my $score = 0; my $parts = $curRes->parts(); + my $multipart = scalar(@{$parts}) > 1; + for my $part (@{$parts}) { - my $partAvail = $curRes->weight($part); - my $partScore = $curRes->awarded($part) * $partAvail; - $avail += $partAvail; - $score += $partScore; + if ($multipart && $part eq '0') { next; } + $totalParts++; + + my $status = $curRes->status($part); + my $color = $statusColorMap{$status}; + if ($color eq $green) { # I'm being bad here... ;-) + $totalRight++; $totalCurrentlyPossible++; + } + if ($color eq $yellow || $color eq $orange) { + $totalCurrentlyPossible++; + } + + $r->print("
" . + "$title" . + ($multipart ? ', ' . $part : '') . '
' + ."\n"); + + if (!($totalParts % 20)) { $r->rflush(); } } - - $r->print("$score / $avail\n"); - $totalAvailable += $avail; - $total += $score; } $curRes = $iterator->next(); } - $r->print("Total Points Scored: $total"); - $r->print("
Total Points Available: $totalAvailable"); - $r->print("\n\n"); + $r->print("

\n"); + $r->print("
"); + $r->print("Total Parts Correct: $totalRight
"); + $r->print("Number Of Parts Possibly Correct: $totalCurrentlyPossible
"); + $r->print("Total Parts In Course: $totalParts
\n\n"); $r->print("");