--- loncom/interface/statistics/lonproblemanalysis.pm 2004/02/18 17:33:12 1.69 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/02/18 19:16:55 1.70 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.69 2004/02/18 17:33:12 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.70 2004/02/18 19:16:55 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -191,8 +191,9 @@ sub BuildProblemAnalysisPage { ######################################################### sub prepare_excel_output { my ($r,$problem,$ProblemData,$Students) = @_; - my ($resource,$respid) = ($problem->{'resource'}, - $problem->{'respid'}); + my ($resource,$respid,$partid) = ($problem->{'resource'}, + $problem->{'respid'}, + $problem->{'part'}); $r->print('

'. &mt('Preparing Excel spreadsheet of student responses'). '

'); @@ -200,7 +201,10 @@ sub prepare_excel_output { &GetStudentAnswers($r,$problem,$Students); # my @Columns = ( 'username','domain','attempt','time', - 'submission','correct', 'grading'); + 'submission','correct', 'grading','awarded','weight', + 'score'); + my $awarded_col = 7; + my $weight_col = 8; # # Create excel worksheet my $filename = '/prtspool/'. @@ -221,6 +225,9 @@ sub prepare_excel_output { 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'}); @@ -230,16 +237,22 @@ sub prepare_excel_output { # # Populate the worksheet with the student data foreach my $student (@$Students) { - # For each attempt - # write the username, domain, attempt number, timestamp, - # submission, correct answer, grading 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') { - my %row; - $row{'username'} = $student->{'username'}; - $row{'domain'} = $student->{'domain'}; - $row{'correct'} = $student->{'answer'}; + $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})) { @@ -251,23 +264,33 @@ sub prepare_excel_output { $rows_output++; } else { foreach my $response (@$results) { + delete($row{'time'}); + delete($row{'attempt'}); + delete($row{'submission'}); + delete($row{'awarded'}); + delete($row{'grading'}); + delete($row{'score'}); my %row_format; - my %row; # # Time is handled differently $row{'time'} = &calc_serial( $response->[&Apache::loncoursedata::RDs_timestamp()]); $row_format{'time'}=$format->{'date'}; # - $row{'username'} = $student->{'username'}; - $row{'domain'} = $student->{'domain'}; $row{'attempt'} = $response->[ &Apache::loncoursedata::RDs_tries()]; $row{'submission'} = $response->[ &Apache::loncoursedata::RDs_submission()]; - $row{'correct'} = $student->{'answer'}; $row{'grading'} = $response->[ &Apache::loncoursedata::RDs_awarddetail()]; + $row{'awarded'} = $response->[ + &Apache::loncoursedata::RDs_awarded()]; + $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) { $worksheet->write($rows_output,$cols_output++,$row{$col},