--- loncom/interface/statistics/lonstudentsubmissions.pm 2004/03/16 16:41:26 1.10 +++ loncom/interface/statistics/lonstudentsubmissions.pm 2004/09/01 21:13:04 1.15 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentsubmissions.pm,v 1.10 2004/03/16 16:41:26 matthew Exp $ +# $Id: lonstudentsubmissions.pm,v 1.15 2004/09/01 21:13:04 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,10 +43,6 @@ my @SubmitButtons = ({ name => 'PrevProb { name => 'NextProblem', text => 'Next Problem' }, { name => 'break'}, - { name => 'ClearCache', - text => 'Clear Caches' }, - { name => 'updatecaches', - text => 'Update Student Data' }, { name => 'SelectAnother', text => 'Choose a different Problem' }, { name => 'Generate', @@ -75,18 +71,8 @@ sub BuildStudentSubmissionsPage { $r->print('
$/|g; + $data->{'submission'} =~ s|\\||g; + $data->{'submission'} = '
'.$data->{'submission'}.'
'; + # + my $Str = ''.&mt("Unable to create new Excel file. ". + "This error has been logged. ". + "Please alert your LON-CAPA administrator"). + '
'); + return undef; + } + # + $workbook->set_tempdir('/home/httpd/perl/tmp'); + # + my $format = &Apache::loncommon::define_excel_formats($workbook); + my $worksheet = $workbook->addworksheet('Student Submission Data'); + # + # Make sure we get new weight data instead of data on a 10 minute delay + &Apache::lonnet::clear_EXT_cache_status(); + # + # Put on the standard headers and whatnot + my $rows_output=0; + $worksheet->write($rows_output++,0,$resource->{'title'},$format->{'h1'}); + $worksheet->write($rows_output++,0,$resource->{'src'},$format->{'h3'}); + $rows_output++; + $worksheet->write_row($rows_output++,0,\@Columns,$format->{'bold'}); + # + # Populate the worksheet with the student data + foreach my $student (@$Students) { + last if ($c->aborted()); + my $results = &Apache::loncoursedata::get_response_data_by_student + ($student,$resource->{'symb'},$respid); + my %row; + $row{'username'} = $student->{'username'}; + $row{'domain'} = $student->{'domain'}; + $row{'correct'} = $student->{'answer'}; + $row{'weight'} = &Apache::lonnet::EXT + ('resource.'.$partid.'.weight',$resource->{'symb'}, + undef,undef,undef); + if (! defined($results) || ref($results) ne 'ARRAY') { + $row{'score'} = '='. + &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell + ($rows_output,$awarded_col) + .'*'. + &Spreadsheet::WriteExcel::Utility::xl_rowcol_to_cell + ($rows_output,$weight_col); + my $cols_output = 0; + foreach my $col (@Columns) { + if (! exists($row{$col})) { + $cols_output++; + next; + } + $worksheet->write($rows_output,$cols_output++,$row{$col}); + } + $rows_output++; + } else { + for (my $i=0;$i'. + &mt('Your Excel spreadsheet.'). + '
'."\n"); + $r->print(''); + $r->rflush(); + return; + +} + +=cut + +######################################################### +######################################################### +## ## Excel output of student answers and correct answers ## ######################################################### @@ -168,15 +587,35 @@ sub prepare_excel_output { $problem->{'part'}); $r->print(''. + &mt('See the status bar above for student answer computation progress'). + '
'); + # + if ($ENV{'form.correctans'} eq 'true') { + &Apache::lonstathelpers::GetStudentAnswers($r,$problem,$Students, + 'Statistics', + 'stats_status'); + } # - my @Columns = ( 'username','domain','attempt','time', - 'submission','correct', 'grading','awarded','weight', - 'score'); - my $awarded_col = 7; - my $weight_col = 8; + $r->print(''); + $r->rflush(); + my @Columns; + push(@Columns,'username'); + push(@Columns,'domain'); + push(@Columns,'attempt'); + push(@Columns,'time'); + push(@Columns,'submission'); + if ($ENV{'form.correctans'} eq 'true') { push(@Columns,'correct'); } + push(@Columns,'grading'); + push(@Columns,'awarded'); + my $awarded_col = $#Columns; + push(@Columns,'weight'); + my $weight_col = $#Columns; + push(@Columns,'score'); # # Create excel worksheet my $filename = '/prtspool/'. @@ -215,7 +654,7 @@ sub prepare_excel_output { my %row; $row{'username'} = $student->{'username'}; $row{'domain'} = $student->{'domain'}; - $row{'correct'} = $student->{'answer'}; + $row{'correct'} = $student->{'answer'}; $row{'weight'} = &Apache::lonnet::EXT ('resource.'.$partid.'.weight',$resource->{'symb'}, undef,undef,undef); @@ -236,7 +675,12 @@ sub prepare_excel_output { } $rows_output++; } else { - foreach my $response (@$results) { + for (my $i=0;$i'. &mt('Your Excel spreadsheet.'). '
'."\n"); + $r->print(''); + $r->rflush(); + return; } ######################################################### @@ -300,14 +750,14 @@ sub CreateInterface { my $Str = ''; $Str .= &Apache::lonhtmlcommon::breadcrumbs (undef,'Student Submission Reports'); + $Str .= ''; $Str .= '
'.&mt('Sections').' | '; $Str .= ''.&mt('Enrollment Status').' | '; - $Str .= ''; + $Str .= ' | '; $Str .= ' |
'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= ' | '; @@ -316,31 +766,57 @@ sub CreateInterface { $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= ''; # - $Str .= ''; + # Render problem checkbox + my $prob_checkbox = ''; + # + # extra submission data checkbox + my $subdata_checkbox = ''; + # + $Str .= ' | '.' '. + ' '. + ' '. + ' '. + ' | ';
#
- my $only_seq_with_assessments = sub {
- my $s=shift;
- if ($s->{'num_assess'} < 1) {
- return 0;
- } else {
- return 1;
- }
- };
- ##
- ##
$Str .= '