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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 31 Aug 2004 15:22:51 -0000


matthew		Tue Aug 31 11:22:51 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentsubmissions.pm 
  Log:
  Added checkbox for computation of correct answers.
  
  
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.12 loncom/interface/statistics/lonstudentsubmissions.pm:1.13
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.12	Fri Jun 25 16:43:33 2004
+++ loncom/interface/statistics/lonstudentsubmissions.pm	Tue Aug 31 11:22:51 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentsubmissions.pm,v 1.12 2004/06/25 20:43:33 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.13 2004/08/31 15:22:51 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -162,19 +162,36 @@
               &mt('See the status bar above for student answer computation progress').
               '</p>');
     #
-    &Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students,
-                                               'Statistics','stats_status');
+    if ($ENV{'form.correctans'} eq 'true') {
+        &Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students,
+                                                   'Statistics',
+                                                   'stats_status');
+    }
     #
     $r->print('<script>'.
               'window.document.Statistics.stats_status.value="'.
               'Done computing student answers.  Compiling spreadsheet.'.
               '";</script>');
     $r->rflush();
-    my @Columns = ( 'username','domain','attempt','time',
-                    'submission','correct', 'grading','awarded','weight',
-                    'score');
-    my $awarded_col = 7;
-    my $weight_col  = 8;
+    my @Columns;
+    push(@Columns,'username');
+    push(@Columns,'domain');
+    push(@Columns,'attempt');
+    push(@Columns,'time');
+    push(@Columns,'submission');
+    if ($ENV{'form.correctans'} eq 'true') { push(@Columns,'correct'); }
+    push(@Columns,'grading');
+    push(@Columns,'awarded');
+    push(@Columns,'weight');
+    push(@Columns,'score');
+    my ($awarded_col,$weight_col);
+    if ($ENV{'form.correctans'} eq 'true') {
+        $awarded_col = 7;
+        $weight_col  = 8;
+    } else {
+        $awarded_col = 6;
+        $weight_col  = 7;
+    }
     #
     # Create excel worksheet
     my $filename = '/prtspool/'.
@@ -213,7 +230,7 @@
         my %row;
         $row{'username'} = $student->{'username'};
         $row{'domain'}   = $student->{'domain'};
-        $row{'correct'} = $student->{'answer'};
+        $row{'correct'}  = $student->{'answer'};
         $row{'weight'} = &Apache::lonnet::EXT
             ('resource.'.$partid.'.weight',$resource->{'symb'},
              undef,undef,undef);
@@ -309,6 +326,7 @@
     $Str .= '<tr>';
     $Str .= '<td align="center"><b>'.&mt('Sections').'</b></td>';
     $Str .= '<td align="center"><b>'.&mt('Enrollment Status').'</b></td>';
+    $Str .= '<td>&nbsp;</td>';
     $Str .= '</tr>'."\n";
     #
     $Str .= '<tr><td align="center">'."\n";
@@ -319,6 +337,14 @@
     $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5);
     $Str .= '</td>';
     #
+    my $checkbox = '<input type="checkbox" name="correctans" ';
+    if (exists($ENV{'form.correctans'}) && $ENV{'form.correctans'} eq 'true') {
+        $checkbox .= ' checked ';
+    }
+    $checkbox .= 'value="true" />';
+    $Str .= '<td align="center">'.'<label><b>'.
+        &mt('compute correct answers [_1]',$checkbox).'</b></label>'.'</td>';
+    #
     $Str .= '</tr>'."\n";
     $Str .= '</table>'."\n";
     #