--- loncom/interface/statistics/lonstudentassessment.pm 2004/04/06 21:42:26 1.81.2.3 +++ loncom/interface/statistics/lonstudentassessment.pm 2004/01/27 19:50:03 1.82 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.81.2.3 2004/04/06 21:42:26 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.82 2004/01/27 19:50:03 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,8 +163,6 @@ 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; @@ -787,22 +785,20 @@ sub StudentAverageTotal { $total_ave += $ave; my $max = $Statistics->{$seq->{'symb'}}->{'max'}; $total_max += $max; - if ($ave == 0) { - $ave = "0.00"; - } - $ave .= ' '; - $max .= '   '; + $ave = sprintf("%.2f",$ave); $Str .= ''.$seq->{'title'}.''. - ''.$ave.''. - ''.$max.''."\n"; + ''.$ave.' '. + ''.$max.' '.''."\n"; } - $total_ave = int(100*$total_ave)/100; # only two digit + $total_ave = sprintf('%.2f',$total_ave); # only two digit $Str .= "\n"; $Str .= ''."\n"; $Str .= ''. "\n"; - $Str .= ''. - ''; + $Str .= ''. + ''. + ''. + ''; $Str .= "
Number of StudentsAverageMaximum
'.($num_students-$nodata_count).''.$total_ave.''.$total_max.'
'.($num_students-$nodata_count).''.$total_ave.' '.''.$total_max.' '.'
\n"; return $Str; } @@ -992,9 +988,9 @@ END $cols_output = 0; $excel_sheet->write($rows_output++,$cols_output++,$datadescription); # -# if ($data eq 'tries' || $data eq 'scores') { - $rows_output+=2; -# } + if ($data eq 'tries' || $data eq 'scores') { + $rows_output++; + } # # Add the student headers $cols_output = 0; @@ -1002,9 +998,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'; @@ -1018,13 +1014,9 @@ END ($rows_output,$cols_output); $seq->{'Excel:startcol'}=$cols_output; # Put the names of the problems and parts into the sheet + my $count = 0; foreach my $res (@{$seq->{'contents'}}) { - if ($res->{'type'} ne 'assessment' || - ! exists($res->{'parts'}) || - ref($res->{'parts'}) ne 'ARRAY' || - scalar(@{$res->{'parts'}}) < 1) { - next; - } + next if ($res->{'type'} ne 'assessment'); if (scalar(@{$res->{'parts'}}) > 1) { foreach my $part (@{$res->{'parts'}}) { $excel_sheet->write($rows_output, @@ -1036,12 +1028,17 @@ END $cols_output++, $res->{'title'}); } + $count++; } # Determine ending cell - $seq->{'Excel:endcell'} = + if ($count == 1) { + $seq->{'Excel:endcell'} = $seq->{'Excel:startcell'}; + $seq->{'Excel:endcol'} = $seq->{'Excel:startcol'}; + } else { &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell - ($rows_output,$cols_output-1); - $seq->{'Excel:endcol'}=$cols_output-1; + ($rows_output,$cols_output-1); + $seq->{'Excel:endcol'} = $cols_output-1; + } # Create the formula for summing up this sequence $seq->{'Excel:sum'}= $excel_sheet->store_formula ('=SUM('.$seq->{'Excel:startcell'}. @@ -1067,11 +1064,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 += 1; -# } else { + if ($data eq 'sum and total' || $data eq 'parts correct total') { + $rows_output += 2; + } else { $rows_output += 1; -# } + } # # Output a row for MAX $cols_output = 0;