[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /homework lonhomework.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 16 Feb 2006 01:25:34 -0000


albertel		Wed Feb 15 20:25:34 2006 EDT

  Modified files:              (Branch: version_2_1_X)
    /loncom/homework	lonhomework.pm 
  Log:
  - backport 1.235
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.233 loncom/homework/lonhomework.pm:1.233.2.1
--- loncom/homework/lonhomework.pm:1.233	Fri Feb 10 13:36:37 2006
+++ loncom/homework/lonhomework.pm	Wed Feb 15 20:25:33 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.233 2006/02/10 18:36:37 albertel Exp $
+# $Id: lonhomework.pm,v 1.233.2.1 2006/02/16 01:25:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -297,12 +297,15 @@
 	$slotstatus='CAN_ANSWER';
     }
 
-    my ($got_grade,$checkedin);
+    my ($is_correct,$got_grade,$checkedin);
     if ($type eq 'Task') {
 	my $version=$Apache::lonhomework::history{'resource.0.version'};
 	$got_grade = 
 	    ($Apache::lonhomework::history{"resource.$version.0.status"} 
 	     =~ /^(?:pass|fail)$/);
+	$is_correct =  
+	    ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass'
+	     || $Apache::lonhomework::history{"resource.0.solved"} =~ /^correct_/ );
 	$checkedin =
 	    $Apache::lonhomework::history{"resource.$version.0.checkedin"};
     } elsif ($type eq 'problem') {
@@ -310,6 +313,8 @@
 	$checkedin = $Apache::lonhomework::history{"resource.0.checkedin"};
     }
     
+    &Apache::lonxml::debug(" slot is $slotstatus checkedin ($checkedin) got_grade ($got_grade) is_correct ($is_correct)");
+    
     if ($slotstatus eq 'NOT_IN_A_SLOT' 
 	&& $checkedin ) {
 
@@ -320,6 +325,9 @@
 	}
 
     }
+    if ( $is_correct) {
+	return ('SHOW_ANSWER');
+    }
     if ( $status eq 'CANNOT_ANSWER' && 
 	 ($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) {
 	return ($status,$datemsg);