--- loncom/interface/statistics/lonstudentassessment.pm 2005/02/28 17:23:11 1.116 +++ loncom/interface/statistics/lonstudentassessment.pm 2005/03/14 20:28:22 1.119 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.116 2005/02/28 17:23:11 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.119 2005/03/14 20:28:22 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -173,11 +173,13 @@ sub BuildStudentAssessmentPage { if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) { return; } + $r->print('

'. + &Apache::lonstatistics::section_and_enrollment_description(). + '

'); # my $initialize = \&html_initialize; my $output_student = \&html_outputstudent; my $finish = \&html_finish; - &Apache::lonnet::logthis('got here! 1'); # if ($output_mode eq 'excel') { $initialize = \&excel_initialize; @@ -189,7 +191,6 @@ sub BuildStudentAssessmentPage { $finish = \&csv_finish; } # - &Apache::lonnet::logthis('got here! 2'); if($c->aborted()) { return ; } # # Determine which students we want to look at @@ -214,7 +215,6 @@ sub BuildStudentAssessmentPage { # # Call the initialize routine selected above $initialize->($r); - &Apache::lonnet::logthis('got here! 3'); foreach my $student (@Students) { if($c->aborted()) { $finish->($r); @@ -683,7 +683,7 @@ sub html_initialize { # Use 1 digit for a space $width{$symb}->{'width_sum'} += 1; } - $total_count += $width{$symb}->{'num_assess_parts'}; + $total_count += &count_parts($navmap,$seq); # Use 3 digits for the sum $width{$symb}->{'width_sum'} += 3; } @@ -763,7 +763,7 @@ sub html_outputstudent { my $studentstats; my $PerformanceStr = ''; foreach my $seq (@sequences) { - &Apache::lonnet::logthis('computing student data for '.$seq->compTitle); + my $symb = $seq->symb; my ($performance,$performance_length,$score,$seq_max,$rawdata); if ($chosen_output->{'tries'}) { ($performance,$performance_length,$score,$seq_max,$rawdata) = @@ -775,7 +775,8 @@ sub html_outputstudent { $navmap,$seq,$show_links); } my $ratio=''; - if ($chosen_output->{'every_problem'}) { + if ($chosen_output->{'every_problem'} && + $chosen_output->{'sequence_sum'}) { $ratio .= ' '; } if ($chosen_output->{'sequence_sum'} && $score ne ' ') { @@ -795,15 +796,15 @@ sub html_outputstudent { $performance = ''; $performance_length=0; } - $performance .= ' 'x($width{$seq->symb}->{'width_total'} - + $performance .= ' 'x($width{$symb}->{'width_total'} - $performance_length - - $width{$seq->symb}->{'width_sum'}). + $width{$symb}->{'width_sum'}). $ratio; # $Str .= $performance.$padding; # - $studentstats->{$seq->symb}->{'score'}= $score; - $studentstats->{$seq->symb}->{'max'} = $seq_max; + $studentstats->{$symb}->{'score'}= $score; + $studentstats->{$symb}->{'max'} = $seq_max; } # # Total it up and store the statistics info. @@ -939,6 +940,7 @@ sub SingleStudentTotal { my $excel_sheet; my $excel_workbook; +my $format; my $filename; my $rows_output; @@ -1005,9 +1007,6 @@ sub excel_initialize { } return if ($request_aborted); # - $filename = '/prtspool/'. - $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'. - time.'_'.rand(1000000000).'.xls'; # $excel_workbook = undef; $excel_sheet = undef; @@ -1035,24 +1034,9 @@ sub excel_initialize { my $first_data_row = $rows_output++; # # Create sheet - $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.$filename); - # - # Check for errors - if (! defined($excel_workbook)) { - $r->log_error("Error creating excel spreadsheet $filename: $!"); - $r->print("Problems creating new Excel file. ". - "This error has been logged. ". - "Please alert your LON-CAPA administrator"); - return ; - } - # - # The excel spreadsheet stores temporary data in files, then put them - # together. If needed we should be able to disable this (memory only). - # The temporary directory must be specified before calling 'addworksheet'. - # File::Temp is used to determine the temporary directory. - $excel_workbook->set_tempdir($Apache::lonnet::tmpdir); - # - my $format = &Apache::loncommon::define_excel_formats($excel_workbook); + ($excel_workbook,$filename,$format)= + &Apache::loncommon::create_workbook($r); + return if (! defined($excel_workbook)); # # Add a worksheet my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; @@ -1067,7 +1051,7 @@ sub excel_initialize { # # Put a description of the sections listed my $sectionstring = ''; - my @Sections = @Apache::lonstatistics::SelectedSections; + my @Sections = &Apache::lonstatistics::get_selected_sections(); if (scalar(@Sections) > 1) { if (scalar(@Sections) > 2) { my $last = pop(@Sections);