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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 28 Jun 2005 21:41:45 -0000


albertel		Tue Jun 28 17:41:45 2005 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - more horror of partial correctness
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.331 loncom/interface/lonnavmaps.pm:1.332
--- loncom/interface/lonnavmaps.pm:1.331	Tue Jun 28 17:21:54 2005
+++ loncom/interface/lonnavmaps.pm	Tue Jun 28 17:41:43 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.331 2005/06/28 21:21:54 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.332 2005/06/28 21:41:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -57,6 +57,7 @@
      $resObj->CLOSED       => '',
      $resObj->OPEN         => 'navmap.open.gif',
      $resObj->CORRECT      => 'navmap.correct.gif',
+     $resObj->PARTIALLY_CORRECT      => 'navmap.ellipsis.gif',
      $resObj->INCORRECT    => 'navmap.wrong.gif',
      $resObj->ATTEMPTED    => 'navmap.ellipsis.gif',
      $resObj->ERROR        => ''
@@ -81,7 +82,8 @@
       $resObj->OPEN                   => '',
       $resObj->NOTHING_SET            => '',
       $resObj->ATTEMPTED              => '',
-      $resObj->ANSWER_SUBMITTED       => ''
+      $resObj->ANSWER_SUBMITTED       => '',
+      $resObj->PARTIALLY_CORRECT      => '#006600'
       );
 # And a special case in the nav map; what to do when the assignment
 # is not yet done and due in less then 24 hours
@@ -507,7 +509,7 @@
     if ($status == $res->PAST_DUE_NO_ANSWER) {
         return &mt("Was due")." " . timeToHumanString($res->duedate($part));
     }
-    if ($status == $res->ANSWER_OPEN) {
+    if ($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT) {
         return &mt("Answer available");
     }
     if ($status == $res->EXCUSED) {
@@ -1426,9 +1428,9 @@
         # Step two: Locate what kind of here marker is necessary
         # Determine where the "here" marker is and where the screen jumps to.
 
-        if ($env{'form.postsymb'}) {
+        if ($env{'form.postsymb'} ne '') {
             $here = $jump = &Apache::lonnet::symbclean($env{'form.postsymb'});
-        } elsif ($env{'form.postdata'}) {
+        } elsif ($env{'form.postdata'} ne '') {
             # couldn't find a symb, is there a URL?
             my $currenturl = $env{'form.postdata'};
             #$currenturl=~s/^http\:\/\///;
@@ -4374,14 +4376,17 @@
 
 sub getCompletionStatus {
     my $self = shift;
+    my $part = shift;
     return $self->NETWORK_FAILURE if ($self->{NAV_MAP}->{NETWORK_FAILURE});
 
-    my $status = $self->queryRestoreHash('solved', shift);
+    my $status = $self->queryRestoreHash('solved', $part);
 
     # Left as separate if statements in case we ever do more with this
     if ($status eq 'correct_by_student') {return $self->CORRECT;}
     if ($status eq 'correct_by_scantron') {return $self->CORRECT;}
-    if ($status eq 'correct_by_override') {return $self->CORRECT_BY_OVERRIDE; }
+    if ($status eq 'correct_by_override') {
+	return $self->CORRECT_BY_OVERRIDE;
+    }
     if ($status eq 'incorrect_attempted') {return $self->INCORRECT; }
     if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; }
     if ($status eq 'excused') {return $self->EXCUSED; }
@@ -4485,6 +4490,7 @@
 
 sub TRIES_LEFT       { return 20; }
 sub ANSWER_SUBMITTED { return 21; }
+sub PARTIALLY_CORRECT{ return 22; }
 
 sub status {
     my $self = shift;
@@ -4511,7 +4517,14 @@
     # There are a few whole rows we can dispose of:
     if ($completionStatus == CORRECT ||
         $completionStatus == CORRECT_BY_OVERRIDE ) {
-        return $suppressFeedback? ANSWER_SUBMITTED : CORRECT; 
+	if ( $suppressFeedback ) { return ANSWER_SUBMITTED }
+	my $awarded=$self->awarded($part);
+	if ($awarded < 1 && $awarded > 0) {
+            return PARTIALLY_CORRECT;
+	} elsif ($awarded<1) {
+	    return INCORRECT;
+	}
+	return CORRECT; 
     }
 
     if ($completionStatus == ATTEMPTED) {
@@ -4598,6 +4611,7 @@
       NETWORK_FAILURE()       => ERROR,
       NOTHING_SET()           => CLOSED,
       CORRECT()               => CORRECT,
+      PARTIALLY_CORRECT()     => PARTIALLY_CORRECT,
       EXCUSED()               => CORRECT,
       PAST_DUE_NO_ANSWER()    => INCORRECT,
       PAST_DUE_ANSWER_LATER() => INCORRECT,