--- loncom/interface/statistics/lonproblemanalysis.pm 2004/11/12 19:47:29 1.105 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/12/02 21:53:33 1.106 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.105 2004/11/12 19:47:29 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.106 2004/12/02 21:53:33 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,6 +38,7 @@ use Apache::lonstudentsubmissions(); use HTML::Entities(); use Time::Local(); use Spreadsheet::WriteExcel(); +use capa; my $plotcolors = ['#33ff00', '#0033cc', '#990000', '#aaaa66', '#663399', '#ff9933', @@ -201,6 +202,13 @@ sub numerical_response_analysis { 'stats_status'); $r->print(&numerical_one_dimensional_plot($r,600,150,$answers)); } + # + if (ref($response_data) ne 'ARRAY') { + $r->print('
'. ''.&mt('Distribution of correct answers').''. @@ -652,33 +681,6 @@ sub circle { return &arc($x,$y,$radius,$radius,0,360,$color,$thickness,$filled); } -sub build_student_data_worksheet { - my ($workbook,$format) = @_; - my $rows_output = 3; - my $cols_output = 0; - my $worksheet = $workbook->addworksheet('Student Data'); - $worksheet->write($rows_output++,0,'Student Data',$format->{'h3'}); - my @Headers = ('full name','username','domain','section', - "student\nnumber",'identifier'); - $worksheet->write_row($rows_output++,0,\@Headers,$format->{'header'}); - my @Students = @Apache::lonstatistics::Students; - my $studentrows = &Apache::loncoursedata::get_student_data(\@Students); - my %ids; - foreach my $row (@$studentrows) { - my ($mysqlid,$student) = @$row; - $ids{$student}=$mysqlid; - } - foreach my $student (@Students) { - my $name_domain = $student->{'username'}.':'.$student->{'domain'}; - $worksheet->write_row($rows_output++,0, - [$student->{'fullname'}, - $student->{'username'},$student->{'domain'}, - $student->{'section'},$student->{'id'}, - $ids{$name_domain}]); - } - return $worksheet; -} - ######################################################### ######################################################### ## @@ -700,6 +702,9 @@ sub radio_response_analysis { my $analysis_html; my $foildata = $problem_analysis->{'_Foils'}; my ($table,$foils,$concepts) = &build_foil_index($problem_analysis); + if (! defined($concepts)) { + $concepts = []; + } # my %true_foils; my $num_true = 0; @@ -1593,6 +1598,33 @@ sub OR_time_process_data { ## ######################################################### ######################################################### +sub build_student_data_worksheet { + my ($workbook,$format) = @_; + my $rows_output = 3; + my $cols_output = 0; + my $worksheet = $workbook->addworksheet('Student Data'); + $worksheet->write($rows_output++,0,'Student Data',$format->{'h3'}); + my @Headers = ('full name','username','domain','section', + "student\nnumber",'identifier'); + $worksheet->write_row($rows_output++,0,\@Headers,$format->{'header'}); + my @Students = @Apache::lonstatistics::Students; + my $studentrows = &Apache::loncoursedata::get_student_data(\@Students); + my %ids; + foreach my $row (@$studentrows) { + my ($mysqlid,$student) = @$row; + $ids{$student}=$mysqlid; + } + foreach my $student (@Students) { + my $name_domain = $student->{'username'}.':'.$student->{'domain'}; + $worksheet->write_row($rows_output++,0, + [$student->{'fullname'}, + $student->{'username'},$student->{'domain'}, + $student->{'section'},$student->{'id'}, + $ids{$name_domain}]); + } + return $worksheet; +} + sub OR_excel_sheet { my ($r,$resource,$performance_data,$ORdata) = @_; my $response = ''; |