--- loncom/interface/statistics/lonstudentassessment.pm	2004/01/27 16:58:05	1.81
+++ loncom/interface/statistics/lonstudentassessment.pm	2004/04/06 21:42:26	1.81.2.3
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.81 2004/01/27 16:58:05 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.81.2.3 2004/04/06 21:42:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,6 +163,8 @@ sub BuildStudentAssessmentPage {
     #
     $single_student_mode = 0;
     $single_student_mode = 1 if ($ENV{'form.SelectedStudent'});
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+                                            ['selectstudent']);
     if ($ENV{'form.selectstudent'}) {
         &Apache::lonstatistics::DisplayClasslist($r);
         return;
@@ -990,9 +992,9 @@ END
     $cols_output = 0;
     $excel_sheet->write($rows_output++,$cols_output++,$datadescription);
     #
-    if ($data eq 'tries' || $data eq 'scores') {
-        $rows_output++;
-    }
+#    if ($data eq 'tries' || $data eq 'scores') {
+        $rows_output+=2;
+#    }
     #
     # Add the student headers
     $cols_output = 0;
@@ -1000,9 +1002,9 @@ END
         $excel_sheet->write($rows_output,$cols_output++,$field);
     }
     my $row_offset = 0;
-    if ($data eq 'tries' || $data eq 'scores') {
+#    if ($data eq 'tries' || $data eq 'scores') {
         $row_offset = -1;
-    }
+#    }
     #
     # Add the remaining column headers
     my $total_formula_string = '=0';
@@ -1017,7 +1019,12 @@ END
             $seq->{'Excel:startcol'}=$cols_output;
             # Put the names of the problems and parts into the sheet
             foreach my $res (@{$seq->{'contents'}}) {
-                next if ($res->{'type'} ne 'assessment');
+                if ($res->{'type'} ne 'assessment'  || 
+                    ! exists($res->{'parts'})       ||
+                    ref($res->{'parts'}) ne 'ARRAY' ||
+                    scalar(@{$res->{'parts'}}) < 1) {
+                    next;
+                }
                 if (scalar(@{$res->{'parts'}}) > 1) {
                     foreach my $part (@{$res->{'parts'}}) {
                         $excel_sheet->write($rows_output,
@@ -1060,11 +1067,11 @@ END
     $total_formula = $excel_sheet->store_formula($total_formula_string);
     #
     # Bookkeeping
-    if ($data eq 'sum and total' || $data eq 'parts correct total') {
-        $rows_output += 2;
-    } else {
+#    if ($data eq 'sum and total' || $data eq 'parts correct total') {
+#        $rows_output += 1;
+#    } else {
         $rows_output += 1;
-    }
+#    }
     #
     # Output a row for MAX
     $cols_output = 0;