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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 14 Oct 2002 18:22:45 -0000


bowersj2		Mon Oct 14 14:22:45 2002 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Make the tries display work for multi-part problems. If the user has one
  try left (and had more then one try to start with), highlight the problem,
  just like it's highlighted for "due in less then 24 hours".
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.78 loncom/interface/lonnavmaps.pm:1.79
--- loncom/interface/lonnavmaps.pm:1.78	Mon Oct 14 13:34:10 2002
+++ loncom/interface/lonnavmaps.pm	Mon Oct 14 14:22:45 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.78 2002/10/14 17:34:10 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.79 2002/10/14 18:22:45 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1156,6 +1156,14 @@
                         $curRes->duedate() > time()) {
                         $color = $hurryUpColor;
                     }
+                    # Special case: If this is the last try, and there is
+                    # more then one available, give a bit of urgency
+                    my $tries = $curRes->tries($part);
+                    my $maxtries = $curRes->maxtries($part);
+                    if ($tries && $maxtries && $maxtries > 1 &&
+                        $maxtries - $tries == 1) {
+                        $color = $hurryUpColor;
+                    }
                     if ($color ne "") {
                         $colorizer = "bgcolor=\"$color\"";
                     }
@@ -1332,7 +1340,7 @@
         return "Open " . timeToHumanString($res->opendate($part));
     }
     if ($status == $res->OPEN) {
-        if ($res->duedate()) {
+        if ($res->duedate($part)) {
             return "Due " . timeToHumanString($res->duedate($part));
         } else {
             return "Open, no due date";
@@ -1354,9 +1362,15 @@
         return "Not yet graded.";
     }
     if ($status == $res->TRIES_LEFT) {
-        my $tries = $res->tries();
-        my $maxtries = $res->maxtries();
-        my $triesString = "($tries of $maxtries tries used)";
+        my $tries = $res->tries($part);
+        my $maxtries = $res->maxtries($part);
+        my $triesString = "";
+        if ($tries && $maxtries) {
+            $triesString = "<font size=\"-1\"><i>($tries of $maxtries tries used)</i></font>";
+            if ($maxtries > 1 && $maxtries - $tries == 1) {
+                $triesString = "<b>$triesString</b>";
+            }
+        }
         if ($res->duedate()) {
             return "Due " . timeToHumanString($res->duedate($part)) .
                 " $triesString";
@@ -2830,7 +2844,7 @@
     # If it's WRONG...
     if ($completionStatus == INCORRECT || $completionStatus == INCORRECT_BY_OVERRIDE) {
         # and there are TRIES LEFT:
-        if ($self->tries() < $self->maxtries()) {
+        if ($self->tries($part) < $self->maxtries($part) || !$self->maxtries($part)) {
             return TRIES_LEFT;
         }
         return INCORRECT; # otherwise, return orange; student can't fix this