[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm

raeburn raeburn@source.lon-capa.org
Sun, 28 Feb 2010 23:27:37 -0000


raeburn		Sun Feb 28 23:27:37 2010 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - Bug 6119 Anonymous Surveys.
    - New awards for surveys:
      ANONYMOUS
      ANONYMOUS_CREDIT
      SUBMITTED_CREDIT
        - given for question types: anonsurvey, anonsurvey_cred, survey_cred.
        - anonsurvey -- course personnel can not view both identity of submitter
                       and submission details.
        - anonsurveycred -- same anonymity, but submitter receives 'awarded' for
                           submission
        -surveycred - submitter receives 'awarded' for submission to survey.
    - New item stored for problem part in submission record -- resource.$id.type
      for anonsurvey and anonsurvey_cred
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.260 loncom/homework/inputtags.pm:1.261
--- loncom/homework/inputtags.pm:1.260	Fri Jul 17 15:27:17 2009
+++ loncom/homework/inputtags.pm	Sun Feb 28 23:27:36 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.260 2009/07/17 15:27:17 droeschl Exp $
+# $Id: inputtags.pm,v 1.261 2010/02/28 23:27:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -573,8 +573,10 @@
 			       'BAD_FORMULA', 'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', 
 			       'MISORDERED_RANK', 'INVALID_FILETYPE',
                                'EXCESS_FILESIZE', 'DRAFT',
-			       'SUBMITTED', 'ASSIGNED_SCORE',
-			       'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') {
+			       'SUBMITTED', 'SUBMITTED_CREDIT', 
+                               'ANONYMOUS', 'ANONYMOUS_CREDIT',
+                               'ASSIGNED_SCORE', 'APPROX_ANS',
+			       'EXACT_ANS','COMMA_FAIL') {
 	if ($award eq $possibleaward) { return 1; }
     }
     return 0;
@@ -588,6 +590,7 @@
 		  'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR',
 		  'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK',
 		  'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'DRAFT', 'SUBMITTED',
+                  'SUBMITTED_CREDIT', 'ANONYMOUS', 'ANONYMOUS_CREDIT',
                   'ASSIGNED_SCORE', 'APPROX_ANS', 'EXACT_ANS');
     my $i=0;
     my %fwd_awards = map { ($_,$i++) } @awards;
@@ -611,7 +614,7 @@
 	return 1;
     }
     if ($award =~
-	/^(?:EXACT_ANS|APPROX_ANS|SUBMITTED|ASSIGNED_SCORE|INCORRECT)/) {
+	/^(?:EXACT_ANS|APPROX_ANS|SUBMITTED|SUBMITTED_CREDIT|ANONYMOUS|ANONYMOUS_CREDIT|ASSIGNED_SCORE|INCORRECT)/) {
 	return 1;
     }
     return 0;
@@ -872,6 +875,17 @@
 	$message = &mt("Your submission has been recorded.");
 	$css_class=$possible_class{'no_grade'};
 	$button=1;
+    } elsif ($award eq 'SUBMITTED_CREDIT') {
+        $message = &mt("Your submission has been recorded, and credit awarded.");
+        $css_class=$possible_class{'correct'};
+        $button=1;
+    } elsif ($award eq 'ANONYMOUS') {
+        $message = &mt("Your anonymous submission has been recorded.");
+        $css_class=$possible_class{'no_grade'};
+        $button=1;
+    } elsif ($award eq 'ANONYMOUS_CREDIT') {
+        $message = &mt("Your anonymous submission has been recorded, and credit awarded.");
+        $css_class=$possible_class{'correct'};
     } elsif ($award eq 'DRAFT') {
 	$message = &mt("Copy saved but not submitted.");
 	$css_class=$possible_class{'not_charged_try'};
@@ -1035,6 +1049,18 @@
 	    $Apache::lonhomework::results{"resource.$id.solved"} =
 		$solvemsg;
 	    $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
+        } elsif ( $award eq 'SUBMITTED_CREDIT' ) {
+            $Apache::lonhomework::results{"resource.$id.tries"} =
+                $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+            $Apache::lonhomework::results{"resource.$id.solved"} =
+                'credit_attempted';
+            $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
+        }  elsif ( $award eq 'ANONYMOUS_CREDIT' ) {
+            $Apache::lonhomework::results{"resource.$id.tries"} =
+                $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+            $Apache::lonhomework::results{"resource.$id.solved"} =
+                'credit_attempted';
+            $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
 	} elsif ( $award eq 'INCORRECT' ) {
 	    $Apache::lonhomework::results{"resource.$id.tries"} =
 		$Apache::lonhomework::history{"resource.$id.tries"} + 1;
@@ -1049,6 +1075,11 @@
 		$Apache::lonhomework::history{"resource.$id.tries"} + 1;
 	    $Apache::lonhomework::results{"resource.$id.solved"} =
 		'ungraded_attempted';
+        }  elsif ( $award eq 'ANONYMOUS' ) {
+            $Apache::lonhomework::results{"resource.$id.tries"} =
+                $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+            $Apache::lonhomework::results{"resource.$id.solved"} =
+                'ungraded_attempted';
 	} elsif ( $award eq 'DRAFT' ) {
 	    $Apache::lonhomework::results{"resource.$id.solved"} = '';
 	} elsif ( $award eq 'NO_RESPONSE' ) {
@@ -1108,6 +1139,10 @@
     if ($award eq 'SUBMITTED') {
 	&Apache::response::add_to_gradingqueue();
     }
+    if (($Apache::lonhomework::type eq 'anonsurvey') ||
+        ($Apache::lonhomework::type eq 'anonsurveycred')) {
+        $Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type;
+    }
 }
 
 sub find_which_previous {
@@ -1222,6 +1257,9 @@
     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
     my $tries_text=&mt('Tries');
     if ( $Apache::lonhomework::type eq 'survey' ||
+         $Apache::lonhomework::type eq 'surveycred' ||
+         $Apache::lonhomework::type eq 'anonsurvey' ||
+         $Apache::lonhomework::type eq 'anonsurveycred' ||
 	 $Apache::lonhomework::parsing_a_task) {
 	$tries_text=&mt('Submissions');
     }