Diff for /loncom/interface/statistics/lonstudentassessment.pm between versions 1.115 and 1.119

version 1.115, 2005/02/25 23:32:23 version 1.119, 2005/03/14 20:28:22
Line 173  sub BuildStudentAssessmentPage { Line 173  sub BuildStudentAssessmentPage {
     if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) {      if (! exists($ENV{'form.notfirstrun'}) && ! $single_student_mode) {
         return;          return;
     }      }
       $r->print('<h4>'.
                 &Apache::lonstatistics::section_and_enrollment_description().
                 '</h4>');
     #      #
     my $initialize     = \&html_initialize;      my $initialize     = \&html_initialize;
     my $output_student = \&html_outputstudent;      my $output_student = \&html_outputstudent;
     my $finish         = \&html_finish;      my $finish         = \&html_finish;
     &Apache::lonnet::logthis('got here! 1');  
     #      #
     if ($output_mode eq 'excel') {      if ($output_mode eq 'excel') {
         $initialize     = \&excel_initialize;          $initialize     = \&excel_initialize;
Line 189  sub BuildStudentAssessmentPage { Line 191  sub BuildStudentAssessmentPage {
         $finish         = \&csv_finish;          $finish         = \&csv_finish;
     }      }
     #      #
     &Apache::lonnet::logthis('got here! 2');  
     if($c->aborted()) {  return ; }      if($c->aborted()) {  return ; }
     #      #
     # Determine which students we want to look at      # Determine which students we want to look at
Line 214  sub BuildStudentAssessmentPage { Line 215  sub BuildStudentAssessmentPage {
     #      #
     # Call the initialize routine selected above      # Call the initialize routine selected above
     $initialize->($r);      $initialize->($r);
     &Apache::lonnet::logthis('got here! 3');  
     foreach my $student (@Students) {      foreach my $student (@Students) {
         if($c->aborted()) {           if($c->aborted()) { 
             $finish->($r);              $finish->($r);
Line 683  sub html_initialize { Line 683  sub html_initialize {
                 # Use 1 digit for a space                  # Use 1 digit for a space
                 $width{$symb}->{'width_sum'} += 1;                              $width{$symb}->{'width_sum'} += 1;            
             }              }
     $total_count += $width{$symb}->{'num_assess_parts'};      $total_count += &count_parts($navmap,$seq);
             # Use 3 digits for the sum              # Use 3 digits for the sum
             $width{$symb}->{'width_sum'} += 3;              $width{$symb}->{'width_sum'} += 3;
         }          }
Line 763  sub html_outputstudent { Line 763  sub html_outputstudent {
     my $studentstats;      my $studentstats;
     my $PerformanceStr = '';      my $PerformanceStr = '';
     foreach my $seq (@sequences) {      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);          my ($performance,$performance_length,$score,$seq_max,$rawdata);
         if ($chosen_output->{'tries'}) {          if ($chosen_output->{'tries'}) {
             ($performance,$performance_length,$score,$seq_max,$rawdata) =              ($performance,$performance_length,$score,$seq_max,$rawdata) =
Line 775  sub html_outputstudent { Line 775  sub html_outputstudent {
                                                  $navmap,$seq,$show_links);                                                   $navmap,$seq,$show_links);
         }          }
         my $ratio='';          my $ratio='';
         if ($chosen_output->{'every_problem'}) {          if ($chosen_output->{'every_problem'} && 
               $chosen_output->{'sequence_sum'}) {
             $ratio .= ' ';              $ratio .= ' ';
         }          }
         if ($chosen_output->{'sequence_sum'} && $score ne ' ') {          if ($chosen_output->{'sequence_sum'} && $score ne ' ') {
Line 795  sub html_outputstudent { Line 796  sub html_outputstudent {
             $performance = '';              $performance = '';
     $performance_length=0;      $performance_length=0;
         }          }
         $performance .= ' 'x($width{$seq->symb}->{'width_total'} -          $performance .= ' 'x($width{$symb}->{'width_total'} -
                              $performance_length -                               $performance_length -
                              $width{$seq->symb}->{'width_sum'}).                               $width{$symb}->{'width_sum'}).
             $ratio;              $ratio;
         #          #
         $Str .= $performance.$padding;          $Str .= $performance.$padding;
         #          #
         $studentstats->{$seq->symb}->{'score'}= $score;          $studentstats->{$symb}->{'score'}= $score;
         $studentstats->{$seq->symb}->{'max'}  = $seq_max;          $studentstats->{$symb}->{'max'}  = $seq_max;
     }      }
     #      #
     # Total it up and store the statistics info.      # Total it up and store the statistics info.
Line 939  sub SingleStudentTotal { Line 940  sub SingleStudentTotal {
   
 my $excel_sheet;  my $excel_sheet;
 my $excel_workbook;  my $excel_workbook;
   my $format;
   
 my $filename;  my $filename;
 my $rows_output;  my $rows_output;
Line 1005  sub excel_initialize { Line 1007  sub excel_initialize {
     }      }
     return if ($request_aborted);      return if ($request_aborted);
     #      #
     $filename = '/prtspool/'.  
         $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.  
             time.'_'.rand(1000000000).'.xls';  
     #      #
     $excel_workbook = undef;      $excel_workbook = undef;
     $excel_sheet = undef;      $excel_sheet = undef;
Line 1035  sub excel_initialize { Line 1034  sub excel_initialize {
     my $first_data_row = $rows_output++;      my $first_data_row = $rows_output++;
     #      #
     # Create sheet      # Create sheet
     $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.$filename);      ($excel_workbook,$filename,$format)=
     #          &Apache::loncommon::create_workbook($r);
     # Check for errors      return if (! defined($excel_workbook));
     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);  
     #      #
     # Add a worksheet      # Add a worksheet
     my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};      my $sheetname = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
Line 1067  sub excel_initialize { Line 1051  sub excel_initialize {
     #      #
     # Put a description of the sections listed      # Put a description of the sections listed
     my $sectionstring = '';      my $sectionstring = '';
     my @Sections = @Apache::lonstatistics::SelectedSections;      my @Sections = &Apache::lonstatistics::get_selected_sections();
     if (scalar(@Sections) > 1) {      if (scalar(@Sections) > 1) {
         if (scalar(@Sections) > 2) {          if (scalar(@Sections) > 2) {
             my $last = pop(@Sections);              my $last = pop(@Sections);
Line 1610  END Line 1594  END
             &Apache::loncommon::csv_translate($seq->compTitle).'",';              &Apache::loncommon::csv_translate($seq->compTitle).'",';
         my $count = 0;          my $count = 0;
         if ($chosen_output->{'every_problem'}) {          if ($chosen_output->{'every_problem'}) {
             foreach my $res (@{$seq->{'contents'}}) {              foreach my $res (&get_resources($navmap,$seq)) {
                 if (scalar(@{$res->parts}) < 1) {                  if (scalar(@{$res->parts}) < 1) {
                     next;                      next;
                 }                  }

Removed from v.1.115  
changed lines
  Added in v.1.119


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>