Diff for /loncom/interface/statistics/lonstudentassessment.pm between versions 1.122 and 1.126

version 1.122, 2005/04/07 07:34:52 version 1.126, 2006/01/22 02:10:03
Line 622  Return a line of the chart for a student Line 622  Return a line of the chart for a student
     my @sequences;      my @sequences;
     my $navmap; # Have to keep this around since weakref is a bit zealous      my $navmap; # Have to keep this around since weakref is a bit zealous
   
   sub html_cleanup {
       undef(%prog_state);
       undef(%width);
       #
       undef($navmap);
       undef(@sequences);
   }
   
 sub html_initialize {  sub html_initialize {
     my ($r) = @_;      my ($r) = @_;
     #      #
     $padding = ' 'x3;      $padding = ' 'x3;
     $count = 0;      $count = 0;
     $nodata_count = 0;      $nodata_count = 0;
     undef(%prog_state);      &html_cleanup();
     undef(%width);  
     #  
     undef($navmap);  
     undef(@sequences);  
     ($navmap,@sequences) =       ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();          &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {      if (! ref($navmap)) {
Line 710  sub html_initialize { Line 714  sub html_initialize {
     $Str .= "<pre>";      $Str .= "<pre>";
     $r->print($Str);      $r->print($Str);
     $r->rflush();      $r->rflush();
       #
       # Let the user know what we are doing
       my $studentcount = scalar(@Apache::lonstatistics::Students); 
       if ($env{'form.SelectedStudent'}) {
           $studentcount = '1';
       }
       #
       # Initialize progress window
       %prog_state=&Apache::lonhtmlcommon::Create_PrgWin
           ($r,'HTML Chart Status',
            'HTML Chart Progress', $studentcount,
            'inline',undef,'Statistics','stats_status');
       #
       &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,
                                             'Processing first student');
     return;      return;
 }  }
   
Line 822  sub html_outputstudent { Line 841  sub html_outputstudent {
     $r->print($Str);      $r->print($Str);
     #      #
     $r->rflush();      $r->rflush();
       &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
     return;      return;
 }      }    
   
Line 839  sub html_finish { Line 859  sub html_finish {
         }          }
     }      }
     $r->rflush();      $r->rflush();
     undef($navmap);      &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
       &html_cleanup();
     return;      return;
 }  }
   
Line 946  my %formula_data; Line 967  my %formula_data;
 my $navmap;  my $navmap;
 my @sequences;  my @sequences;
   
 sub excel_initialize {  sub excel_cleanup {
     my ($r) = @_;  
     #      #
     undef ($excel_sheet);      undef ($excel_sheet);
     undef ($excel_workbook);      undef ($excel_workbook);
Line 963  sub excel_initialize { Line 983  sub excel_initialize {
     #      #
     undef($navmap);      undef($navmap);
     undef(@sequences);      undef(@sequences);
   }
   
   sub excel_initialize {
       my ($r) = @_;
   
       &excel_cleanup();
     ($navmap,@sequences) =       ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();          &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {      if (! ref($navmap)) {
Line 1043  sub excel_initialize { Line 1069  sub excel_initialize {
     my $sectionstring = '';      my $sectionstring = '';
     my @Sections = &Apache::lonstatistics::get_selected_sections();      my @Sections = &Apache::lonstatistics::get_selected_sections();
     $excel_sheet->write($header_row,$cols_output++,      $excel_sheet->write($header_row,$cols_output++,
                         &Apache::lonstatistics::section_and_enrollment_description('plain text'),                          &Apache::lonstatistics::section_and_enrollment_description('plaintext'),
                         $format->{'h3'});                          $format->{'h3'});
     #      #
     # Put the date in there too      # Put the date in there too
Line 1385  sub excel_outputstudent { Line 1411  sub excel_outputstudent {
             if ($chosen_output->{'correct'}) {              if ($chosen_output->{'correct'}) {
                 # only indiciate if each item is correct or not                  # only indiciate if each item is correct or not
                 foreach my $value (@$rawdata) {                  foreach my $value (@$rawdata) {
                     # nonzero means correct                      # positive means correct, 0 or negative means
                     $value = 1 if ($value > 0);                      # incorrect
                       $value = $value > 0 ? 1 : 0;
                     $excel_sheet->write($rows_output,$cols_output++,$value);                      $excel_sheet->write($rows_output,$cols_output++,$value);
                 }                  }
             } else {              } else {
Line 1448  sub excel_outputstudent { Line 1475  sub excel_outputstudent {
 sub excel_finish {  sub excel_finish {
     my ($r) = @_;      my ($r) = @_;
     if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {      if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
    &excel_cleanup();
         return;          return;
     }      }
     #      #
     # Write the excel file      # Write the excel file
     $excel_workbook->close();      $excel_workbook->close();
     my $c = $r->connection();  
     #  
     return if($c->aborted());  
     #      #
     # Close the progress window      # Close the progress window
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);      &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
Line 1464  sub excel_finish { Line 1489  sub excel_finish {
     $r->print('<br />'.      $r->print('<br />'.
               '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");                '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n");
     $r->rflush();      $r->rflush();
       &excel_cleanup();
     return;      return;
 }  }
   
Line 1494  my %prog_state; # progress window state Line 1520  my %prog_state; # progress window state
 my $navmap;  my $navmap;
 my @sequences;  my @sequences;
   
 sub csv_initialize{  sub csv_cleanup {
     my ($r) = @_;  
     #   
     # Clean up  
     undef($outputfile);      undef($outputfile);
     undef($filename);      undef($filename);
     undef($request_aborted);      undef($request_aborted);
Line 1505  sub csv_initialize{ Line 1528  sub csv_initialize{
     #      #
     undef($navmap);      undef($navmap);
     undef(@sequences);      undef(@sequences);
   }
   
   sub csv_initialize{
       my ($r) = @_;
   
       &csv_cleanup();
     ($navmap,@sequences) =       ($navmap,@sequences) = 
         &Apache::lonstatistics::selected_sequences_with_assessments();          &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {      if (! ref($navmap)) {
Line 1690  sub csv_outputstudent { Line 1719  sub csv_outputstudent {
 sub csv_finish {  sub csv_finish {
     my ($r) = @_;      my ($r) = @_;
     if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {      if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
    &csv_cleanup();
         return;          return;
     }      }
     close($outputfile);      close($outputfile);
     #      #
     my $c = $r->connection();  
     return if ($c->aborted());  
     #  
     # Close the progress window      # Close the progress window
     &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);      &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
     #      #
Line 1704  sub csv_finish { Line 1731  sub csv_finish {
     $r->print('<br />'.      $r->print('<br />'.
               '<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n");                '<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n");
     $r->rflush();      $r->rflush();
       &csv_cleanup();
     return;      return;
           
 }  }
Line 1797  sub student_tries_on_sequence { Line 1825  sub student_tries_on_sequence {
                 } elsif ($status eq 'incorrect_by_override') {                  } elsif ($status eq 'incorrect_by_override') {
                     $symbol = '-';                      $symbol = '-';
                 } elsif ($status eq 'ungraded_attempted') {                  } elsif ($status eq 'ungraded_attempted') {
                     $symbol = '#';                      $symbol = 'u';
                 } elsif ($status eq 'incorrect_attempted' ||                  } elsif ($status eq 'incorrect_attempted' ||
                          $tries > 0)  {                           $tries > 0)  {
                     $symbol = '.';                      $symbol = '.';
Line 1914  sub student_performance_on_sequence { Line 1942  sub student_performance_on_sequence {
             if (length($symbol) > 1) {              if (length($symbol) > 1) {
                 $symbol = '*';                  $symbol = '*';
             }              }
             if (exists($resource_data->{'resource.'.$part.'.solved'})) {              if (exists($resource_data->{'resource.'.$part.'.solved'}) &&
                   $resource_data->{'resource.'.$part.'.solved'} ne '') {
                 my $status = $resource_data->{'resource.'.$part.'.solved'};                  my $status = $resource_data->{'resource.'.$part.'.solved'};
                 if ($status eq 'excused') {                  if ($status eq 'excused') {
                     $symbol = 'x';                      $symbol = 'x';
                     $max -= $weight; # Do not count 'excused' problems.                      $max -= $weight; # Do not count 'excused' problems.
                   } elsif ($status eq 'ungraded_attempted') {
                       $symbol = 'u';
                 }                  }
                 $hasdata = 1;                  $hasdata = 1;
               } elsif ($resource_data->{'resource.'.$part.'.award'} eq 'DRAFT') {
                   $symbol = 'd';
                   $hasdata = 1;
             } elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){              } elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){
                 # Unsolved.  Did they try?                  # Unsolved.  Did they try?
                 if (exists($resource_data->{'resource.'.$part.'.tries'})){                  if (exists($resource_data->{'resource.'.$part.'.tries'})){
Line 1969  problems. Line 2003  problems.
 #######################################################  #######################################################
 sub CreateLegend {  sub CreateLegend {
     my $Str = "<p><pre>".      my $Str = "<p><pre>".
               "   1  correct by student in 1 try\n".                " digit score or number of tries to get correct ".
               "   7  correct by student in 7 tries\n".  
               "   *  correct by student in more than 9 tries\n".                "   *  correct by student in more than 9 tries\n".
       "   +  correct by hand grading or override\n".        "   +  correct by hand grading or override\n".
               "   -  incorrect by override\n".                "   -  incorrect by override\n".
       "   .  incorrect attempted\n".        "   .  incorrect attempted\n".
       "   #  ungraded attempted\n".        "   u  ungraded attempted\n".
                 "   d  draft answer saved but not submitted\n".
               "      not attempted (blank field)\n".                "      not attempted (blank field)\n".
       "   x  excused".        "   x  excused".
               "</pre><p>";                "</pre><p>";

Removed from v.1.122  
changed lines
  Added in v.1.126


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