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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Mon, 12 May 2003 18:22:38 -0000


bowersj2		Mon May 12 14:22:38 2003 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Fix bug 1430 "problems never see themselves as correct".
  
  Fix bug #628 for nav maps, honoring the problemstatus flag, assuming
  'No" is the value that turns that off and everything else means "Yes".
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.184 loncom/interface/lonnavmaps.pm:1.185
--- loncom/interface/lonnavmaps.pm:1.184	Mon May  5 13:44:03 2003
+++ loncom/interface/lonnavmaps.pm	Mon May 12 14:22:38 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.184 2003/05/05 17:44:03 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.185 2003/05/12 18:22:38 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,7 +71,8 @@
       $resObj->TRIES_LEFT         => 'navmap.open.gif',
       $resObj->INCORRECT          => 'navmap.wrong.gif',
       $resObj->OPEN               => 'navmap.open.gif',
-      $resObj->ATTEMPTED          => 'navmap.open.gif' );
+      $resObj->ATTEMPTED          => 'navmap.open.gif',
+      $resObj->ANSWER_SUBMITTED   => '' );
 
 my %iconAltTags = 
     ( 'navmap.correct.gif' => 'Correct',
@@ -365,6 +366,9 @@
             return "No due date $triesString";
         }
     }
+    if ($status == $res->ANSWER_SUBMITTED) {
+        return 'Answer submitted';
+    }
 }
 
 # Convenience function, so others can use it: Is the problem due in less then
@@ -2799,7 +2803,10 @@
 sub parmval {
     my $self = shift;
     my $what = shift;
-    my $part = shift || "0";
+    my $part = shift;
+    if (!defined($part)) { 
+        $part = '0'; 
+    }
     return $self->{NAV_MAP}->parmval($part.'.'.$what, $self->symb());
 }
 
@@ -2973,6 +2980,10 @@
     }
     return $self->parmval("opendate");
 }
+sub problemstatus {
+    (my $self, my $part) = @_;
+    return $self->parmval("problemstatus", $part);
+}
 sub sig {
     (my $self, my $part) = @_;
     return $self->parmval("sig", $part);
@@ -3366,7 +3377,7 @@
     my $self = shift;
     my $hashentry = shift;
     my $part = shift;
-    $part = "0" if (!defined($part));
+    $part = "0" if (!defined($part) || $part eq '');
     return $self->NETWORK_FAILURE if ($self->{NAV_MAP}->{NETWORK_FAILURE});
 
     $self->getReturnHash();
@@ -3384,7 +3395,10 @@
 represent the status of the resource as a whole. The precise logic is
 documented in the comments of the status method. The following results
 may be returned, all available as methods on the resource object
-($res->NETWORK_FAILURE):
+($res->NETWORK_FAILURE): In addition to the return values that match
+the date or completion status, this function can return "ANSWER_SUBMITTED"
+if that problemstatus parameter value is set to No, suppressing the
+incorrect/correct feedback.
 
 =over 4
 
@@ -3443,11 +3457,16 @@
 
 The problem has been attempted.
 
+=item * B<ANSWER_SUBMITTED>:
+
+An answer has been submitted, but the student should not see it.
+
 =back
 
 =cut
 
-sub TRIES_LEFT { return 10; }
+sub TRIES_LEFT       { return 20; }
+sub ANSWER_SUBMITTED { return 21; }
 
 sub status {
     my $self = shift;
@@ -3462,10 +3481,12 @@
 
     if ($completionStatus == NETWORK_FAILURE) { return NETWORK_FAILURE; }
 
+    my $suppressFeedback = $self->parmval("problemstatus", $part) eq 'No';
+
     # There are a few whole rows we can dispose of:
     if ($completionStatus == CORRECT ||
         $completionStatus == CORRECT_BY_OVERRIDE ) {
-        return CORRECT; 
+        return $suppressFeedback? ANSWER_SUBMITTED : CORRECT; 
     }
 
     if ($completionStatus == ATTEMPTED) {
@@ -3506,7 +3527,7 @@
         if ($self->tries($part) < $self->maxtries($part) || !$self->maxtries($part)) {
             return TRIES_LEFT;
         }
-        return INCORRECT; # otherwise, return orange; student can't fix this
+        return $suppressFeedback ? ANSWER_SUBMITTED : INCORRECT; # otherwise, return orange; student can't fix this
     }
 
     # Otherwise, it's untried and open