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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 14 May 2004 20:30:17 -0000


matthew		Fri May 14 16:30:17 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemstatistics.pm 
  Log:
  Added commented-out code to help Behrouz gather research data on problems.
  Added excel format field support to excel data output.
  
  
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.84 loncom/interface/statistics/lonproblemstatistics.pm:1.85
--- loncom/interface/statistics/lonproblemstatistics.pm:1.84	Fri Apr 16 17:43:56 2004
+++ loncom/interface/statistics/lonproblemstatistics.pm	Fri May 14 16:30:17 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemstatistics.pm,v 1.84 2004/04/16 21:43:56 matthew Exp $
+# $Id: lonproblemstatistics.pm,v 1.85 2004/05/14 20:30:17 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -96,6 +96,10 @@
 ##                                      statistics display?
 ## selected        yes     (yes|no)     Is the column selected by default?
 ##
+## format          no      sprintf format string
+##
+## excel_format    no      excel format type 
+##                               (see &Apache::loncommon::define_excel_formats
 my @Fields = (
            { name => 'problem_num',
              title => 'P#',
@@ -261,6 +265,39 @@
              selectable => 'yes',
              defaultselected => 'no',
            },
+##   duedate included for research purposes.  Commented out most of the time.
+#           { name => 'duedate',
+#             title => 'Due Date',
+#             align => 'left',
+#             color => '#FFFFFF',
+#             sortable => 'yes',
+#             graphable => 'no',
+#             long_title => 'Due date of resource for instructor',
+#             selectable => 'no',
+#             defaultselected => 'yes',
+#            },
+##   opendate included for research purposes.  Commented out most of the time.
+#           { name => 'opendate',
+#             title => 'Open Date',
+#             align => 'left',
+#             color => '#FFFFFF',
+#             sortable => 'yes',
+#             graphable => 'no',
+#             long_title => 'date resource became answerable',
+#             selectable => 'no',
+#             defaultselected => 'yes',
+#            },
+##   symb included for research purposes.  Commented out most of the time.
+#           { name => 'symb',
+#             title => 'Symb',
+#             align => 'left',
+#             color => '#FFFFFF',
+#             sortable => 'yes',
+#             graphable => 'no',
+#             long_title => 'Unique LON-CAPA identifier for problem',
+#             selectable => 'no',
+#             defaultselected => 'yes',
+#            },
 );
 
 my @SeqFields = (
@@ -1241,8 +1278,12 @@
         $cols_output=0;
         foreach my $field (@SeqFields) {
             next if ($field->{'selected'} ne 'yes');
+            my $fieldformat = undef;
+            if (exists($field->{'excel_format'})) {
+                $fieldformat = $format->{$field->{'excel_format'}};
+            }
             $excel_sheet->write($rows_output,$cols_output++,
-                                $data->{$field->{'name'}});
+                                $data->{$field->{'name'}},$fieldformat);
         }
         $rows_output++;
         $cols_output=0;
@@ -1260,8 +1301,12 @@
         foreach my $field (@Fields) {
             next if ($field->{'selected'} ne 'yes');
             next if ($field->{'name'} eq 'problem_num');
+            my $fieldformat = undef;
+            if (exists($field->{'excel_format'})) {
+                $fieldformat = $format->{$field->{'excel_format'}};
+            }
             $excel_sheet->write($rows_output,$cols_output++,
-                                $data->{$field->{'name'}});
+                                $data->{$field->{'name'}},$fieldformat);
         }
         $rows_output++;
         $cols_output=0;
@@ -1441,6 +1486,7 @@
                         (\@Apache::lonstatistics::SelectedSections,
                          $Apache::lonstatistics::enrollment_status,
                          $symb,$part,$courseid,$starttime,$endtime);
+    $data->{'symb'}        = $symb;
     $data->{'part'}        = $part;
     $data->{'problem_num'} = $problem_num;
     $data->{'container'}   = $sequence->{'title'};
@@ -1467,6 +1513,12 @@
         my ($dom,$user) = $urlres=~/^(\w+)\/(\w+)/; 
         &Apache::lonnet::put('nohist_resevaldata',\%storestats,$dom,$user);
     }
+    #
+    # Get the due date for research purposes (commented out most of the time)
+#    $data->{'duedate'} = 
+#        &Apache::lonnet::EXT('resource.'.$part.'.duedate',$symb);
+#    $data->{'opendate'} = 
+#        &Apache::lonnet::EXT('resource.'.$part.'.opendate',$symb);
     return $data;
 }