--- loncom/interface/statistics/lonproblemstatistics.pm 2003/03/26 17:03:41 1.44 +++ loncom/interface/statistics/lonproblemstatistics.pm 2003/03/28 15:20:59 1.48 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemstatistics.pm,v 1.44 2003/03/26 17:03:41 matthew Exp $ +# $Id: lonproblemstatistics.pm,v 1.48 2003/03/28 15:20:59 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,7 +26,26 @@ # # (Navigate problems for statistical reports # -### +############################################### +############################################### + +=pod + +=head1 NAME + +lonproblemstatistics + +=head1 SYNOPSIS + +Routines to present problem statistics to instructors via tables, +Excel files, and plots. + +=over 4 + +=cut + +############################################### +############################################### package Apache::lonproblemstatistics; @@ -37,9 +56,20 @@ use Apache::loncoursedata; use Apache::lonstatistics; use Spreadsheet::WriteExcel; -####################################################### -####################################################### +############################################### +############################################### + +=pod + +=item &CreateInterface() +Create the main intereface for the statistics page. Allows the user to +select sections, maps, and output. + +=cut + +############################################### +############################################### sub CreateInterface { my $Str = ''; $Str .= '
'."\n"); @@ -262,22 +338,21 @@ sub output_html_grouped_by_sequence { foreach my $resource (@{$sequence->{'contents'}}) { next if ($resource->{'type'} ne 'assessment'); foreach my $part (@{$resource->{'parts'}}) { + $problem_num++; my ($num,$tries,$mod,$mean,$Solved,$solved,$DegOfDiff,$STD, - $SKEW) = &Apache::loncoursedata::get_problem_statistics - (undef,$resource->{'symb'},$part, - $ENV{'request.course.id'}); + $SKEW) = &get_statistics($resource->{'symb'},$part); # - $show_part = 1 if ($part ne '0'); $part = ' ' if ($part == 0); # my $wrongpercent = 0; if (defined($num) && $num > 0) { $wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10; } + my $option = ''; $r->print(' | ||
'."\n"); $r->rflush(); @@ -330,10 +421,9 @@ sub output_html_ungrouped { foreach my $resource (@{$sequence->{'contents'}}) { next if ($resource->{'type'} ne 'assessment'); foreach my $part (@{$resource->{'parts'}}) { + $problem_num++; my ($num,$tries,$mod,$mean,$Solved,$solved,$DegOfDiff,$STD, - $SKEW) = &Apache::loncoursedata::get_problem_statistics - (undef,$resource->{'symb'},$part, - $ENV{'request.course.id'}); + $SKEW) = &get_statistics($resource->{'symb'},$part); # $show_part = 1 if ($part ne '0'); $part = ' ' if ($part == 0); @@ -357,6 +447,7 @@ sub output_html_ungrouped { 'DoDiff' => $DegOfDiff, 'S.D.' => $STD, 'Skew' => $SKEW, + 'problem_num' => $problem_num, }); } } @@ -368,7 +459,7 @@ sub output_html_ungrouped { foreach (@Header) { next if ($_ eq 'Part' && !$show_part); # Do not allow sorting on some fields - if ($_ eq $sortby || /^(Part)$/) { + if ($_ eq $sortby || /^(Part|P\#)$/) { $Str .= ' | '.$_.' | '; } else { $Str .= ''. @@ -417,13 +508,22 @@ sub output_html_ungrouped { } @Statsarray; } } + $option .= ',no part' if (! $show_part); foreach my $row (@OutputOrder) { $r->print(' |
---|---|---|
'.$row->{'problem_num'}.' | '); + } if ($show_container) { $r->print('' .$row->{'sequence'}->{'title'}.' | '); } - $r->print(&stats_row_from_hash($row,$show_part)); + $r->print(&statistics_html_table_data + ($row->{'resource'},$row->{'Part'},$row->{'#Stdnts'}, + $row->{'Tries'},$row->{'Mod'},$row->{'Mean'}, + $row->{'#YES'},$row->{'#yes'},$row->{"\%Wrng"}, + $row->{'DoDiff'},$row->{'S.D.'},$row->{'Skew'}, + $option)); $r->print("
".&DrawGraph(\@Data,$title,'Problem Number',$yaxis, + $Max)."
\n"); + # + # Print out the data + $ENV{'form.sortby'} = 'Contents'; + &output_html_ungrouped($r,'show probnum'); return; } +############################################### +############################################### + +=pod + +=item &DrawGraph() + +=cut + +############################################### +############################################### sub DrawGraph { - my ($values,$courseDescription,$title,$Max,$r)=@_; + my ($values,$title,$xaxis,$yaxis,$Max)=@_; + $title = '' if (! defined($title)); + $xaxis = '' if (! defined($xaxis)); + $yaxis = '' if (! defined($yaxis)); + # my $sendValues = join(',', @$values); my $sendCount = scalar(@$values); - $r->print("'."\n");
- $r->print(' |