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

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 07 Mar 2003 18:46:38 -0000


matthew		Fri Mar  7 13:46:38 2003 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
    /loncom/interface/statistics	lonstudentassessment.pm 
  Log:
  moved &get_sequences_to_show from lonstudentassessment.pm to
  &Sequences_with_Assess in lonstatistics.pm.
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.63 loncom/interface/lonstatistics.pm:1.64
--- loncom/interface/lonstatistics.pm:1.63	Mon Mar  3 14:17:51 2003
+++ loncom/interface/lonstatistics.pm	Fri Mar  7 13:46:38 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.63 2003/03/03 19:17:51 matthew Exp $
+# $Id: lonstatistics.pm,v 1.64 2003/03/07 18:46:38 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -434,6 +434,33 @@
     } else {
         @SelectedMaps = ('all');
     }
+}
+
+
+#######################################################
+#######################################################
+
+=pod
+
+=item &Sequences_with_Assess()
+
+Returns an array containing the subset of @Sequences which contain
+assessments.
+
+=cut
+
+#######################################################
+#######################################################
+sub Sequences_with_Assess {
+    my @Sequences_to_Show;
+    foreach my $map_symb (@SelectedMaps) {
+        foreach my $sequence (@Sequences) {
+            next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all');
+            next if ($sequence->{'num_assess'} < 1);
+            push (@Sequences_to_Show,$sequence);
+        }
+    }
+    return @Sequences_to_Show;
 }
 
 #######################################################
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.39 loncom/interface/statistics/lonstudentassessment.pm:1.40
--- loncom/interface/statistics/lonstudentassessment.pm:1.39	Fri Mar  7 12:01:45 2003
+++ loncom/interface/statistics/lonstudentassessment.pm	Fri Mar  7 13:46:38 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstudentassessment.pm,v 1.39 2003/03/07 17:01:45 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.40 2003/03/07 18:46:38 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -198,19 +198,6 @@
     return @to_show;
 }
 
-sub get_sequences_to_show {
-    my @Sequences;
-    foreach my $map_symb (@Apache::lonstatistics::SelectedMaps) {
-        foreach my $sequence (@Apache::lonstatistics::Sequences) {
-            next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all');
-            next if ($sequence->{'num_assess'} < 1);
-            push (@Sequences,$sequence);
-        }
-    }
-    return @Sequences;
-}
-
-
 #######################################################
 #######################################################
 
@@ -485,7 +472,7 @@
         $Str .= $title.' 'x($width-$base).$padding;
     }
     # Now the selected sequences need to be listed
-    foreach my $sequence (&get_sequences_to_show) {
+    foreach my $sequence (&Apache::lonstatistics::Sequences_with_Assess()){
         my $title = $sequence->{'title'};
         my $base  = $sequence->{'base_width'};
         my $width = $sequence->{'width'};
@@ -538,7 +525,7 @@
     # By sequence build up the data
     my $studentstats;
     my $PerformanceStr = '';
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         my ($performance,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,$show_links);
@@ -608,7 +595,7 @@
     my $total_max = 0;
     $Str .= '<table border=2 cellspacing="1">'."\n";
     $Str .= "<tr><th>Title</th><th>Average</th><th>Maximum</th></tr>\n";
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         my $ave = int(100*($Statistics->{$seq->{'symb'}}->{'score'}/
             ($num_students-$nodata_count)))/100;
         $total_ave += $ave;
@@ -666,7 +653,7 @@
     my $num_data_per_part  = 2; # 'status' and 'numtries'
     my $fields_per_student = scalar(&get_student_fields_to_show());
     my $bytes_per_field    = 20; # Back of the envelope calculation
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         $num_sequences++ if ($seq->{'num_assess'} > 0);
         $fields_per_student += $num_data_per_part * $seq->{'num_assess_parts'};
     }
@@ -812,7 +799,7 @@
     }
     #
     # Add the Sequence Headers
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         $excel_sheet->write($rows_output,$cols_output,$seq->{'title'});
         if ($show eq 'totals') {
             $excel_sheet->write($rows_output+1,$cols_output,'score');
@@ -868,7 +855,7 @@
     }
     #
     # Write out sequence scores and totals data
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         my ($performance,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,'no');
@@ -974,7 +961,7 @@
             $Str .= '"'.&Apache::loncommon::csv_translate($field).'",';
         }
     }
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         if ($show eq 'scores') {
             $Str .= '"'.&Apache::loncommon::csv_translate($seq->{'title'}).
                 '",';
@@ -1028,7 +1015,7 @@
     }
     #
     # Output performance data
-    foreach my $seq (&get_sequences_to_show) {
+    foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
         my ($performance,$score,$seq_max) =
             &StudentPerformanceOnSequence($student,\%StudentsData,
                                           $seq,'no');