Diff for /loncom/interface/statistics/lonproblemstatistics.pm between versions 1.46 and 1.47

version 1.46, 2003/03/26 21:55:18 version 1.47, 2003/03/27 19:26:33
Line 26 Line 26
 #  #
 # (Navigate problems for statistical reports  # (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;  package Apache::lonproblemstatistics;
   
Line 37  use Apache::loncoursedata; Line 56  use Apache::loncoursedata;
 use Apache::lonstatistics;  use Apache::lonstatistics;
 use Spreadsheet::WriteExcel;  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 {  sub CreateInterface {
     my $Str = '';      my $Str = '';
     $Str .= '<table cellspacing="5">'."\n";      $Str .= '<table cellspacing="5">'."\n";
Line 77  sub CreateInterface { Line 107  sub CreateInterface {
   
 =item &CreateAndParseOutputSelector()  =item &CreateAndParseOutputSelector()
   
   Construct a selection list of options for output and parse output selections.
   The current output selected is indicated by the values of the two package
   variables $output_mode and $show.  @OutputOptions holds the descriptions of
   the output options and the values for $output_mode and $show.
   
    Based on code from lonstudentassessment.pm.
   
 =cut  =cut
   
 #######################################################  #######################################################
Line 135  sub OutputDescriptions { Line 172  sub OutputDescriptions {
   
 sub CreateAndParseOutputSelector {  sub CreateAndParseOutputSelector {
     my $Str = '';      my $Str = '';
     my $elementname = 'outputmode';      my $elementname = 'statsoutputmode';
     #      #
     # Format for output options is 'mode, restrictions';      # Format for output options is 'mode, restrictions';
     my $selected = 'html, with links';      my $selected = 'HTML problem statistics grouped';
     if (exists($ENV{'form.'.$elementname})) {      if (exists($ENV{'form.'.$elementname})) {
         if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {          if (ref($ENV{'form.'.$elementname} eq 'ARRAY')) {
             $selected = $ENV{'form.'.$elementname}->[0];              $selected = $ENV{'form.'.$elementname}->[0];
Line 170  sub CreateAndParseOutputSelector { Line 207  sub CreateAndParseOutputSelector {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &Gather_Student_Data()
   
   Ensures all student data is up to date.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub Gather_Student_Data {  sub Gather_Student_Data {
Line 200  sub Gather_Student_Data { Line 245  sub Gather_Student_Data {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &BuildProblemStatisticsPage()
   
   Main interface to problem statistics.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub BuildProblemStatisticsPage {  sub BuildProblemStatisticsPage {
Line 213  sub BuildProblemStatisticsPage { Line 266  sub BuildProblemStatisticsPage {
     $r->print('<input type="hidden" name="sortby" value="'.$ENV{'form.sortby'}.      $r->print('<input type="hidden" name="sortby" value="'.$ENV{'form.sortby'}.
               '" />');                '" />');
     if (! exists($ENV{'form.statsfirstcall'})) {      if (! exists($ENV{'form.statsfirstcall'})) {
           $r->print(<<ENDMSG);
   <p>
   <font size="+1">
   Please make your selections in the boxes above and hit 
   the button marked &quot;Update&nbsp;Display&quot;.
   </font>
   </p>
   ENDMSG
         return;          return;
     }      }
     #      #
Line 248  sub BuildProblemStatisticsPage { Line 309  sub BuildProblemStatisticsPage {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &output_html_grouped_by_sequence()
   
   Presents the statistics data as an html table organized by the order
   the assessments appear in the course.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub output_html_grouped_by_sequence {  sub output_html_grouped_by_sequence {
Line 259  sub output_html_grouped_by_sequence { Line 329  sub output_html_grouped_by_sequence {
                   "S.D.","Skew.");#,"D.F.1st","D.F.2nd");                    "S.D.","Skew.");#,"D.F.1st","D.F.2nd");
     # #FFFFE6 #EEFFCC #DDFFFF FFDDDD #DDFFDD #FFDDFF      # #FFFFE6 #EEFFCC #DDFFFF FFDDDD #DDFFDD #FFDDFF
     foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()) {      foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()) {
         my $show_part = 0;  
         next if ($sequence->{'num_assess'}<1);          next if ($sequence->{'num_assess'}<1);
         $r->print("<h3>".$sequence->{'title'}."</h3>");          $r->print("<h3>".$sequence->{'title'}."</h3>");
         $r->print('<table border="0"><tr><td bgcolor="#777777">'."\n");          $r->print('<table border="0"><tr><td bgcolor="#777777">'."\n");
Line 275  sub output_html_grouped_by_sequence { Line 344  sub output_html_grouped_by_sequence {
                         (undef,$resource->{'symb'},$part,                          (undef,$resource->{'symb'},$part,
                          $ENV{'request.course.id'});                           $ENV{'request.course.id'});
                 #                  #
                 $show_part = 1 if ($part ne '0');  
                 $part = '&nbsp;' if ($part == 0);                  $part = '&nbsp;' if ($part == 0);
                 #                  #
                 my $wrongpercent = 0;                  my $wrongpercent = 0;
Line 283  sub output_html_grouped_by_sequence { Line 351  sub output_html_grouped_by_sequence {
                     $wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10;                      $wrongpercent=int(10*100*($num-$Solved+$solved)/$num)/10;
                 }                  }
                 my $option = '';                  my $option = '';
                 $option .= 'no part' if (! $show_part);  
                 $r->print('<tr>'.&statistics_html_table_data                  $r->print('<tr>'.&statistics_html_table_data
                           ($resource,$part,$num,$tries,$mod,$mean,$Solved,                            ($resource,$part,$num,$tries,$mod,$mean,$Solved,
                            $solved,$wrongpercent,$DegOfDiff,$STD,$SKEW,                             $solved,$wrongpercent,$DegOfDiff,$STD,$SKEW,
Line 302  sub output_html_grouped_by_sequence { Line 369  sub output_html_grouped_by_sequence {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &output_html_ungrouped()
   
   Presents the statistics data in a single html table which can be sorted by
   different columns.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub output_html_ungrouped {  sub output_html_ungrouped {
Line 452  sub output_html_ungrouped { Line 528  sub output_html_ungrouped {
                    $row->{'#YES'},$row->{'#yes'},$row->{"\%Wrng"},                     $row->{'#YES'},$row->{'#yes'},$row->{"\%Wrng"},
                    $row->{'DoDiff'},$row->{'S.D.'},$row->{'Skew'},                     $row->{'DoDiff'},$row->{'S.D.'},$row->{'Skew'},
                    $option));                     $option));
   
         $r->print("</tr>\n");          $r->print("</tr>\n");
     }      }
     $r->print("</table>\n");      $r->print("</table>\n");
Line 462  sub output_html_ungrouped { Line 537  sub output_html_ungrouped {
     return;      return;
 }  }
   
   
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &output_excel()
   
   Presents the statistical data in an Excel 95 compatable spreadsheet file.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub output_excel {  sub output_excel {
Line 587  sub output_excel { Line 669  sub output_excel {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &statistics_html_table_data()
   
   Help function used to format the rows for HTML table output.
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub statistics_html_table_data {  sub statistics_html_table_data {
Line 601  sub statistics_html_table_data { Line 691  sub statistics_html_table_data {
     foreach ($num,$tries) {      foreach ($num,$tries) {
         $row .= '<td bgcolor="#EEFFCC" align="right">'.$_.'</td>';          $row .= '<td bgcolor="#EEFFCC" align="right">'.$_.'</td>';
     }      }
     foreach ($mod,$mean) {      foreach ($mod) {
           $row .= '<td bgcolor="#DDFFFF" align="right">'.$_.'</td>';
       }
       foreach ($mean) {
         $row .= '<td bgcolor="#DDFFFF" align="right">'.          $row .= '<td bgcolor="#DDFFFF" align="right">'.
                   sprintf("%5.2f",$_).'</td>';                    sprintf("%5.2f",$_).'</td>';
     }      }
Line 621  sub statistics_html_table_data { Line 714  sub statistics_html_table_data {
   
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &plot_statistics()
   
   =cut
   
   ###############################################
   ###############################################
 sub plot_statistics {  sub plot_statistics {
     my ($r,$datafield) = @_;      my ($r,$datafield) = @_;
     my @Data;      my @Data;
Line 714  sub plot_statistics { Line 816  sub plot_statistics {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &DrawGraph()
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub DrawGraph {  sub DrawGraph {
Line 742  sub DrawGraph { Line 850  sub DrawGraph {
 ###############################################  ###############################################
 ###############################################  ###############################################
   
   =pod 
   
   =item &ProblemStatisticsLegend()
   
   =cut
   
 ###############################################  ###############################################
 ###############################################  ###############################################
 sub ProblemStatisticsLegend {  sub ProblemStatisticsLegend {

Removed from v.1.46  
changed lines
  Added in v.1.47


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>