--- loncom/interface/statistics/lonstudentassessment.pm 2005/04/08 13:44:43 1.123 +++ loncom/interface/statistics/lonstudentassessment.pm 2006/01/22 02:10:03 1.126 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.123 2005/04/08 13:44:43 albertel Exp $ +# $Id: lonstudentassessment.pm,v 1.126 2006/01/22 02:10:03 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -622,17 +622,21 @@ Return a line of the chart for a student my @sequences; 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 { my ($r) = @_; # $padding = ' 'x3; $count = 0; $nodata_count = 0; - undef(%prog_state); - undef(%width); - # - undef($navmap); - undef(@sequences); + &html_cleanup(); ($navmap,@sequences) = &Apache::lonstatistics::selected_sequences_with_assessments(); if (! ref($navmap)) { @@ -856,7 +860,7 @@ sub html_finish { } $r->rflush(); &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); - undef($navmap); + &html_cleanup(); return; } @@ -963,8 +967,7 @@ my %formula_data; my $navmap; my @sequences; -sub excel_initialize { - my ($r) = @_; +sub excel_cleanup { # undef ($excel_sheet); undef ($excel_workbook); @@ -980,6 +983,12 @@ sub excel_initialize { # undef($navmap); undef(@sequences); +} + +sub excel_initialize { + my ($r) = @_; + + &excel_cleanup(); ($navmap,@sequences) = &Apache::lonstatistics::selected_sequences_with_assessments(); if (! ref($navmap)) { @@ -1060,7 +1069,7 @@ sub excel_initialize { my $sectionstring = ''; my @Sections = &Apache::lonstatistics::get_selected_sections(); $excel_sheet->write($header_row,$cols_output++, - &Apache::lonstatistics::section_and_enrollment_description('plain text'), + &Apache::lonstatistics::section_and_enrollment_description('plaintext'), $format->{'h3'}); # # Put the date in there too @@ -1402,8 +1411,9 @@ sub excel_outputstudent { if ($chosen_output->{'correct'}) { # only indiciate if each item is correct or not foreach my $value (@$rawdata) { - # nonzero means correct - $value = 1 if ($value > 0); + # positive means correct, 0 or negative means + # incorrect + $value = $value > 0 ? 1 : 0; $excel_sheet->write($rows_output,$cols_output++,$value); } } else { @@ -1465,14 +1475,12 @@ sub excel_outputstudent { sub excel_finish { my ($r) = @_; if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) { + &excel_cleanup(); return; } # # Write the excel file $excel_workbook->close(); - my $c = $r->connection(); - # - return if($c->aborted()); # # Close the progress window &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); @@ -1481,6 +1489,7 @@ sub excel_finish { $r->print('
'. 'Your Excel spreadsheet.'."\n"); $r->rflush(); + &excel_cleanup(); return; } @@ -1511,10 +1520,7 @@ my %prog_state; # progress window state my $navmap; my @sequences; -sub csv_initialize{ - my ($r) = @_; - # - # Clean up +sub csv_cleanup { undef($outputfile); undef($filename); undef($request_aborted); @@ -1522,6 +1528,12 @@ sub csv_initialize{ # undef($navmap); undef(@sequences); +} + +sub csv_initialize{ + my ($r) = @_; + + &csv_cleanup(); ($navmap,@sequences) = &Apache::lonstatistics::selected_sequences_with_assessments(); if (! ref($navmap)) { @@ -1707,13 +1719,11 @@ sub csv_outputstudent { sub csv_finish { my ($r) = @_; if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) { + &csv_cleanup(); return; } close($outputfile); # - my $c = $r->connection(); - return if ($c->aborted()); - # # Close the progress window &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); # @@ -1721,6 +1731,7 @@ sub csv_finish { $r->print('
'. ''.&mt('Your csv file.').''."\n"); $r->rflush(); + &csv_cleanup(); return; } @@ -1814,7 +1825,7 @@ sub student_tries_on_sequence { } elsif ($status eq 'incorrect_by_override') { $symbol = '-'; } elsif ($status eq 'ungraded_attempted') { - $symbol = '#'; + $symbol = 'u'; } elsif ($status eq 'incorrect_attempted' || $tries > 0) { $symbol = '.'; @@ -1931,13 +1942,19 @@ sub student_performance_on_sequence { if (length($symbol) > 1) { $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'}; if ($status eq 'excused') { $symbol = 'x'; $max -= $weight; # Do not count 'excused' problems. + } elsif ($status eq 'ungraded_attempted') { + $symbol = 'u'; } $hasdata = 1; + } elsif ($resource_data->{'resource.'.$part.'.award'} eq 'DRAFT') { + $symbol = 'd'; + $hasdata = 1; } elsif (!exists($resource_data->{'resource.'.$part.'.awarded'})){ # Unsolved. Did they try? if (exists($resource_data->{'resource.'.$part.'.tries'})){ @@ -1986,13 +2003,13 @@ problems. ####################################################### sub CreateLegend { my $Str = "

".
-              "   1  correct by student in 1 try\n".
-              "   7  correct by student in 7 tries\n".
+              " digit score or number of tries to get correct ".
               "   *  correct by student in more than 9 tries\n".
 	      "   +  correct by hand grading or override\n".
               "   -  incorrect by override\n".
 	      "   .  incorrect attempted\n".
-	      "   #  ungraded attempted\n".
+	      "   u  ungraded attempted\n".
+              "   d  draft answer saved but not submitted\n".
               "      not attempted (blank field)\n".
 	      "   x  excused".
               "

";