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

onken onken@source.lon-capa.org
Thu, 21 May 2009 04:58:40 -0000


onken		Thu May 21 04:58:40 2009 EDT

  Modified files:              
    /loncom/interface	lonpdfupload.pm 
  Log:
  - parse responses for problem status like EXACT_ANS, APPROX_ANS and INCORRECT into human readable format
  
  
  
Index: loncom/interface/lonpdfupload.pm
diff -u loncom/interface/lonpdfupload.pm:1.7 loncom/interface/lonpdfupload.pm:1.8
--- loncom/interface/lonpdfupload.pm:1.7	Thu May 21 03:09:01 2009
+++ loncom/interface/lonpdfupload.pm	Thu May 21 04:58:40 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpdfupload.pm,v 1.7 2009/05/21 03:09:01 onken Exp $
+# $Id: lonpdfupload.pm,v 1.8 2009/05/21 04:58:40 onken Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -272,11 +272,12 @@
 
         $result .= &Apache::loncommon::start_data_table_row();
         $result .= "<td>$problemname</td><td class='";
-        if($grade eq "EXACT_ANS") {
+        if($grade eq "EXACT_ANS" || $grade eq "APPROX_ANS") {
             $result .= "LC_answer_correct";
         } else { 
             $result .= "LC_answer_charged_try";
         }
+        $grade = &parse_grade_answer($grade);
         $result .= "'>$grade</span></td>";
         $result .= &Apache::loncommon::end_data_table_row();
     }
@@ -306,6 +307,23 @@
     return ($title, $grade);    
 }
 
+sub parse_grade_answer {
+    my ($shortcut) = @_;
+     my %answerhash = ('EXACT_ANS' => &mt('You are correct.'),
+                       'APPROX_ANS' => &mt('You are approximated right'),
+                       'INCORRECT' => &mt('You are incorrect'),
+     );
+
+    foreach my $key (keys %answerhash) {
+        if($shortcut eq $key) {
+            return $answerhash{$shortcut};
+        }  
+    }
+    return &mt('See course contents for further information.');
+
+}
+
+
 sub dumpenv  {
     my $r = shift;