[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemstatistics.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 01 Apr 2004 21:14:32 -0000


This is a MIME encoded message

--matthew1080854072
Content-Type: text/plain

matthew		Thu Apr  1 16:14:32 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemstatistics.pm 
  Log:
  Make sure we compute the data we need to plot.
  @Fields and @SeqFields: Stop modifying what should be static data structures 
  by using different keys for items selected by default and those currently 
  selected.
  
  
--matthew1080854072
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20040401161432.txt"

Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.79 loncom/interface/statistics/lonproblemstatistics.pm:1.80
--- loncom/interface/statistics/lonproblemstatistics.pm:1.79	Thu Apr  1 15:02:56 2004
+++ loncom/interface/statistics/lonproblemstatistics.pm	Thu Apr  1 16:14:32 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemstatistics.pm,v 1.79 2004/04/01 20:02:56 matthew Exp $
+# $Id: lonproblemstatistics.pm,v 1.80 2004/04/01 21:14:32 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -101,7 +101,7 @@
              align => 'right',
              color => '#FFFFE6',
              selectable => 'no',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'container',
              title  => 'Sequence or Folder',
@@ -109,7 +109,7 @@
              color  => '#FFFFE6',
              sortable => 'yes',
              selectable => 'no',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'title',
              title  => 'Title',
@@ -118,14 +118,14 @@
              special  => 'link',
              sortable => 'yes', 
              selectable => 'no',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'part', 
              title  => 'Part',
              align  => 'left',
              color  => '#FFFFE6',
              selectable => 'no',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'num_students',
              title  => '#Stdnts',
@@ -136,7 +136,7 @@
              graphable => 'yes',
              long_title => 'Number of Students Attempting Problem',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'tries',
              title  => 'Tries',
@@ -147,7 +147,7 @@
              graphable => 'yes',
              long_title => 'Total Number of Tries',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'max_tries',
              title  => 'Max Tries',
@@ -158,7 +158,7 @@
              graphable => 'yes',
              long_title => 'Maximum Number of Tries',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'min_tries',
              title  => 'Min Tries',
@@ -169,7 +169,7 @@
              graphable => 'yes',
              long_title => 'Minumum Number of Tries',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'mean_tries',
              title  => 'Mean Tries',
@@ -180,7 +180,7 @@
              graphable => 'yes',
              long_title => 'Average Number of Tries',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'std_tries',
              title  => 'S.D. tries',
@@ -191,7 +191,7 @@
              graphable => 'yes',
              long_title => 'Standard Deviation of Number of Tries',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'skew_tries',
              title  => 'Skew Tries',
@@ -202,7 +202,7 @@
              graphable => 'yes',
              long_title => 'Skew of Number of Tries',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'num_solved',
              title  => '#YES',
@@ -213,7 +213,7 @@
              graphable => 'yes',
              long_title => 'Number of Students able to Solve',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'num_override',
              title  => '#yes',
@@ -224,7 +224,7 @@
              graphable => 'yes',
              long_title => 'Number of Students given Override',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'num_wrong',
              title  => '#Wrng',
@@ -235,7 +235,7 @@
              graphable => 'yes',
              long_title => 'Percent of students whose final answer is wrong',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'deg_of_diff',
              title  => 'DoDiff',
@@ -247,7 +247,7 @@
              long_title => 'Degree of Difficulty'.
                            '[ 1 - ((#YES+#yes) / Tries) ]',
              selectable => 'yes',
-             selected => 'yes',
+             defaultselected => 'yes',
            },
            { name   => 'deg_of_disc',
              title  => 'DoDisc',
@@ -258,7 +258,7 @@
              graphable => 'yes',
              long_title => 'Degree of Discrimination',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
 );
 
@@ -270,7 +270,7 @@
              special  => 'no',
              sortable => 'no', 
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'items',
              title  => '#Items',
@@ -281,7 +281,7 @@
              graphable => 'no',
              long_title => 'Number of Items in Sequence',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'scoremean',
              title  => 'Score Mean',
@@ -292,7 +292,7 @@
              graphable => 'no',
              long_title => 'Mean Sequence Score',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'scorestd',
              title  => 'Score STD',
@@ -303,7 +303,7 @@
              graphable => 'no',
              long_title => 'Standard Deviation of Sequence Scores',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'scoremax',
              title  => 'Score Max',
@@ -314,7 +314,7 @@
              graphable => 'no',
              long_title => 'Maximum Sequence Score',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'scoremin',
              title  => 'Score Min',
@@ -325,7 +325,7 @@
              graphable => 'no',
              long_title => 'Minumum Sequence Score',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'scorecount',
              title  => 'Score N',
@@ -336,7 +336,7 @@
              graphable => 'no',
              long_title => 'Number of Students in score computations',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'countmean',
              title  => 'Count Mean',
@@ -347,7 +347,7 @@
              graphable => 'no',
              long_title => 'Mean Sequence Score',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'countstd',
              title  => 'Count STD',
@@ -358,7 +358,7 @@
              graphable => 'no',
              long_title => 'Standard Deviation of Sequence Scores',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'countmax',
              title  => 'Count Max',
@@ -369,7 +369,7 @@
              graphable => 'no',
              long_title => 'Maximum Number of Correct Problems',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'countmin',
              title  => 'Count Min',
@@ -380,7 +380,7 @@
              graphable => 'no',
              long_title => 'Minumum Number of Correct Problems',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'count',
              title  => 'Count N',
@@ -391,7 +391,7 @@
              graphable => 'no',
              long_title => 'Number of Students in score computations',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },
            { name   => 'KR-21',
              title  => 'KR-21',
@@ -402,7 +402,7 @@
              graphable => 'no',
              long_title => 'KR-21 reliability statistic',
              selectable => 'yes',
-             selected => 'no',
+             defaultselected => 'no',
            },           
 );
 
@@ -415,12 +415,28 @@
         $ENV{'form.fieldselections'} = [];
         foreach my $field (@Fields) {
             next if ($field->{'selectable'} ne 'yes');
-            if ($field->{'selected'} eq 'yes') {
+            if ($field->{'defaultselected'} eq 'yes') {
                 push(@{$ENV{'form.fieldselections'}},$field->{'name'});
             }
         }
     }
     #
+    # Make sure the data we are plotting is there
+    my %NeededFields;
+    if (exists($ENV{'form.plot'}) && $ENV{'form.plot'} ne '' &&
+        $ENV{'form.plot'} ne 'none') {
+        if ($ENV{'form.plot'} eq 'degrees') {
+            $NeededFields{'deg_of_diff'}++;
+            $NeededFields{'deg_of_disc'}++;
+        } elsif ($ENV{'form.plot'} eq 'tries statistics') {
+            $NeededFields{'mean_tries'}++;
+            $NeededFields{'std_tries'}++;
+            $NeededFields{'problem_num'}++;
+        } else {
+            $NeededFields{$ENV{'form.plot'}}++;
+        }
+    }
+    #
     # This should not happen, but in case it does...
     if (ref($ENV{'form.fieldselections'}) ne 'ARRAY') {
         $ENV{'form.fieldselections'} = [$ENV{'form.fieldselections'}];
@@ -429,8 +445,15 @@
     # Set the field data and the selected fields (for easier checking)
     undef(%SelectedFields);
     foreach my $field (@Fields) {
-        next if ($field->{'selectable'} ne 'yes');
-        $field->{'selected'} = 'no';
+        if ($field->{'selectable'} ne 'yes') {
+            $field->{'selected'} = 'yes';
+        } else {
+            $field->{'selected'} = 'no';
+        }
+        if (exists($NeededFields{$field->{'name'}})) {
+            $field->{'selected'} = 'yes';
+            $SelectedFields{$field->{'name'}}++;
+        }
         foreach my $selection (@{$ENV{'form.fieldselections'}}) {
             if ($selection eq $field->{'name'} || $selection eq 'all') {
                 $field->{'selected'} = 'yes';
@@ -470,7 +493,9 @@
 ###############################################
 ###############################################
 sub CreateInterface {
+    #
     &parse_field_selection();
+    #
     my $Str = '';
     $Str .= &Apache::lonhtmlcommon::breadcrumbs
         (undef,'Overall Problem Statistics','Statistics_Overall_Key');

--matthew1080854072--