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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 21 Oct 2003 16:00:31 -0000


matthew		Tue Oct 21 12:00:31 2003 EDT

  Modified files:              
    /loncom/interface/statistics	lonproblemanalysis.pm 
  Log:
  No longer perform analysis when excel output is requested.
  Cosmetic changes, nothing shocking.
  
  
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.43 loncom/interface/statistics/lonproblemanalysis.pm:1.44
--- loncom/interface/statistics/lonproblemanalysis.pm:1.43	Mon Oct 20 16:42:39 2003
+++ loncom/interface/statistics/lonproblemanalysis.pm	Tue Oct 21 12:00:30 2003
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemanalysis.pm,v 1.43 2003/10/20 20:42:39 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.44 2003/10/21 16:00:30 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -91,7 +91,9 @@
         #
         my $resource = &get_resource_from_symb($symb);
         if (defined($resource)) {
+            $r->print('<h1>'.$resource->{'title'}.'</h1>');
             $r->print('<h3>'.$resource->{'src'}.'</h3>');
+            $r->rflush();
             my %Data = &get_problem_data($resource->{'src'});
             my $PerformanceData = 
                 &Apache::loncoursedata::get_optionresponse_data
@@ -118,30 +120,33 @@
                       $rendered_problem.
                       '</td></tr></table>');
             $r->rflush();
-            ##
-            ## Analyze the problem
-            if (defined($PerformanceData) && 
-                ref($PerformanceData) eq 'ARRAY') {
-                if ($ENV{'form.AnalyzeOver'} eq 'Tries') {
-                    my $analysis_html = &tries_analysis($r,$PerformanceData,
-                                                         $ORdata);
-                    $r->print($analysis_html);
-                    $r->rflush();
-                } elsif ($ENV{'form.AnalyzeOver'} eq 'Time') {
-                    my $analysis_html = &time_analysis($PerformanceData,
-                                                         $ORdata);
-                    $r->print($analysis_html);
-                    $r->rflush();
+            if (! exists($ENV{'form.ExcelOutput'})) {
+                ##
+                ## Analyze the problem
+                if (defined($PerformanceData) && 
+                    ref($PerformanceData) eq 'ARRAY') {
+                    if ($ENV{'form.AnalyzeOver'} eq 'Tries') {
+                        my $analysis_html = &tries_analysis($r,
+                                                            $PerformanceData,
+                                                            $ORdata);
+                        $r->print($analysis_html);
+                        $r->rflush();
+                    } elsif ($ENV{'form.AnalyzeOver'} eq 'Time') {
+                        my $analysis_html = &time_analysis($PerformanceData,
+                                                           $ORdata);
+                        $r->print($analysis_html);
+                        $r->rflush();
+                    } else {
+                        $r->print('<h2>'.
+                                  &mt('The analysis you have selected is '.
+                                      'not supported at this time').
+                                  '</h2>');
+                    }
                 } else {
                     $r->print('<h2>'.
-                              &mt('The analysis you have selected is '.
-                                         'not supported at this time').
+                         &mt('There is no student data for this problem.').
                               '</h2>');
                 }
-            } else {
-                $r->print('<h2>'.
-                          &mt('There is no student data for this problem.').
-                          '</h2>');
             }
         } else {
             $r->print('resource is undefined');
@@ -735,10 +740,9 @@
 ##
 #########################################################
 #########################################################
-
 sub prepare_excel_sheet {
     my ($r,$resource,$PerformanceData,$ORdata) = @_;
-    my $response = '<h2>'.&mt('Excel Spreadsheet Creation').'</h2>';
+    my $response = '';
     my (undef,$Foils,$Concepts) = &build_foil_index($ORdata);
     #
     # Create excel worksheet
@@ -761,7 +765,6 @@
     my $format;
     $format->{'header'} = $workbook->add_format(bold      => 1, 
                                                 bottom    => 1,
-#                                                text_wrap => 1,
                                                 align     => 'center');
     $format->{'bold'} = $workbook->add_format(bold=>1);
     $format->{'h1'}   = $workbook->add_format(bold=>1, size=>18);
@@ -796,14 +799,16 @@
     if ($result ne 'okay') {
         # Do something useful
     }
-   $response_data_sheet->activate();
+    $response_data_sheet->activate();
     #
     # Close the excel file
     $workbook->close();
     #
     # Write a link to allow them to download it
-    $result .= '<br />'.
-              '<a href="'.$filename.'">Your Excel spreadsheet.</a>'."\n";
+    $result .= '<h2>'.&mt('Excel Raw Data Output').'</h2>'.
+              '<p><a href="'.$filename.'">'.
+              &mt('Your Excel spreadsheet.').
+              '</a></p>'."\n";
     return $result;
 }