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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 04 Mar 2003 16:10:09 -0000


matthew		Tue Mar  4 11:10:09 2003 EDT

  Modified files:              
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  Added some header information (course desc, sections listed, and date) to
  excel files.
  
  
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.33 loncom/interface/statistics/lonstudentassessment.pm:1.34
--- loncom/interface/statistics/lonstudentassessment.pm:1.33	Tue Mar  4 09:21:36 2003
+++ loncom/interface/statistics/lonstudentassessment.pm	Tue Mar  4 11:10:09 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.33 2003/03/04 14:21:36 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.34 2003/03/04 16:10:09 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -587,17 +587,49 @@
     }
     $excel_sheet = $excel_workbook->addworksheet($sheetname);
     #
+    # Put the course description in the header
+    $excel_sheet->write($rows_output,$cols_output++,
+                   $ENV{'course.'.$ENV{'request.course.id'}.'.description'});
+    $cols_output += 3;
+    #
+    # Put a description of the sections listed
+    my $sectionstring = '';
+    my @Sections = @Apache::lonstatistics::SelectedSections;
+    if (scalar(@Sections) > 1) {
+        if (scalar(@Sections) > 2) {
+            my $last = pop(@Sections);
+            $sectionstring = "Sections ".join(', ',@Sections).', and '.$last;
+        } else {
+            $sectionstring = "Sections ".join(' and ',@Sections);
+        }
+    } else {
+        if ($Sections[0] eq 'all') {
+            $sectionstring = "All sections";
+        } else {
+            $sectionstring = "Section ".$Sections[0];
+        }
+    }
+    $excel_sheet->write($rows_output,$cols_output++,$sectionstring);
+    $cols_output += scalar(@Sections);
+    #
+    # Put the date in there too
+    $excel_sheet->write($rows_output,$cols_output++,
+                        'Compiled on '.localtime(time));
+    #
+    $rows_output++;
+    #
     # Add the student headers
+    $cols_output = 0;
     foreach my $field (&get_student_fields_to_show()) {
-        $excel_sheet->write(1,$cols_output++,$field);
+        $excel_sheet->write($rows_output,$cols_output++,$field);
     }
     #
     # Add the Sequence Headers
     foreach my $seq (&get_sequences_to_show) {
-        $excel_sheet->write(0,$cols_output,$seq->{'title'});
+        $excel_sheet->write($rows_output,$cols_output,$seq->{'title'});
         if ($show eq 'totals') {
-            $excel_sheet->write(1,$cols_output,'score');
-            $excel_sheet->write(1,$cols_output+1,'maximum');
+            $excel_sheet->write($rows_output+1,$cols_output,'score');
+            $excel_sheet->write($rows_output+1,$cols_output+1,'maximum');
             $cols_output += 2;
         } else {
             $cols_output++;
@@ -606,9 +638,9 @@
     #
     # Bookkeeping
     if ($show eq 'totals') {
-        $rows_output = 2;
+        $rows_output += 2;
     } else {
-        $rows_output = 1;
+        $rows_output += 1;
     }
     #
     # Let the user know what we are doing
@@ -681,7 +713,8 @@
         $r->print($num_students.' out of '.
                   (scalar(@Apache::lonstatistics::Students)).
                   " students processed.  ".
-                  $time_est." remain.  <br />\n");
+                  $time_est." remain.  Elapsed: ".(time - $start_time).
+                  "<br />\n");
         $r->rflush();
     }
     return;