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

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


raeburn		Sun Feb 28 23:43:21 2010 EDT

  Modified files:              
    /loncom/homework	rankresponse.pm 
  Log:
  - 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.
  - Do not display submission details on gradng screens for anonymous surveys.
  
  
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.61 loncom/homework/rankresponse.pm:1.62
--- loncom/homework/rankresponse.pm:1.61	Fri Dec 12 09:19:34 2008
+++ loncom/homework/rankresponse.pm	Sun Feb 28 23:43:21 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # rank style response
 #
-# $Id: rankresponse.pm,v 1.61 2008/12/12 09:19:34 bisitz Exp $
+# $Id: rankresponse.pm,v 1.62 2010/02/28 23:43:21 raeburn Exp $
 # Copyright Michigan State University Board of Trustees
 #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -265,9 +265,18 @@
 	    $ad='MISSING_ANSWER';
 	}
     }
-    if ($Apache::lonhomework::type eq 'survey' &&
-	($ad eq 'INCORRECT' || $ad eq 'EXACT_ANS') ) {
-	$ad='SUBMITTED';
+    if (($ad eq 'INCORRECT' || $ad eq 'EXACT_ANS')) {
+        if ($Apache::lonhomework::type eq 'survey') {
+            $ad='SUBMITTED';
+        } elsif ($Apache::lonhomework::type eq 'surveycred') {
+	    $ad='SUBMITTED_CREDIT';
+        } elsif ($Apache::lonhomework::type eq 'anonsurvey') {
+            $ad='ANONYMOUS';
+        } elsif ($Apache::lonhomework::type eq 'anonsurveycred') {
+            $ad='ANONYMOUS_CREDIT';
+        } else {
+            $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
+        }
     } else {
 	$Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
     }
@@ -317,7 +326,10 @@
 	my $temp=1;
 	my $id=$Apache::inputtags::response[-1];
 	my $part=$Apache::inputtags::part;
-	my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
+	my $lastresponse;
+        unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) && (defined($env{'form.grade_symb'}))) {
+            $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
+        }
 	my %lastresponse=&Apache::lonnet::str2hash($lastresponse); 
 	my @alp = splice @alphabet, 0, $#whichopt + 1;
 	my $internal_counter=$Apache::lonxml::counter;