--- loncom/interface/statistics/lonproblemstatistics.pm 2005/03/27 05:08:03 1.103
+++ loncom/interface/statistics/lonproblemstatistics.pm 2008/10/30 17:45:25 1.115
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemstatistics.pm,v 1.103 2005/03/27 05:08:03 matthew Exp $
+# $Id: lonproblemstatistics.pm,v 1.115 2008/10/30 17:45:25 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -50,7 +50,7 @@ Excel files, and plots.
package Apache::lonproblemstatistics;
use strict;
-use Apache::lonnet();
+use Apache::lonnet;
use Apache::loncommon();
use Apache::lonhtmlcommon;
use Apache::loncoursedata;
@@ -60,6 +60,8 @@ use Apache::lonlocal;
use Spreadsheet::WriteExcel;
use Apache::lonstathelpers();
use Time::HiRes;
+use LONCAPA;
+
my @StatsArray;
my %SeqStat; # keys are symbs, values are hash refs
@@ -516,35 +518,35 @@ my %SelectedFields;
sub parse_field_selection {
#
# Pull out the defaults
- if (! defined($ENV{'form.fieldselections'})) {
- $ENV{'form.fieldselections'} = [];
+ if (! defined($env{'form.fieldselections'})) {
+ $env{'form.fieldselections'} = [];
foreach my $field (@Fields) {
next if ($field->{'selectable'} ne 'yes');
if ($field->{'defaultselected'} eq 'yes') {
- push(@{$ENV{'form.fieldselections'}},$field->{'name'});
+ 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') {
+ 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') {
+ } elsif ($env{'form.plot'} eq 'tries statistics') {
$NeededFields{'mean_tries'}++;
$NeededFields{'std_tries'}++;
$NeededFields{'problem_num'}++;
} else {
- $NeededFields{$ENV{'form.plot'}}++;
+ $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'}];
+ if (ref($env{'form.fieldselections'}) ne 'ARRAY') {
+ $env{'form.fieldselections'} = [$env{'form.fieldselections'}];
}
#
# Set the field data and the selected fields (for easier checking)
@@ -559,7 +561,7 @@ sub parse_field_selection {
$field->{'selected'} = 'yes';
$SelectedFields{$field->{'name'}}++;
}
- foreach my $selection (@{$ENV{'form.fieldselections'}}) {
+ foreach my $selection (@{$env{'form.fieldselections'}}) {
if ($selection eq $field->{'name'} || $selection eq 'all') {
$field->{'selected'} = 'yes';
$SelectedFields{$field->{'name'}}++;
@@ -608,39 +610,51 @@ sub CreateInterface {
&parse_field_selection();
#
my $Str = '';
- $Str .= &Apache::lonhtmlcommon::breadcrumbs
- (undef,'Overall Problem Statistics','Statistics_Overall_Key');
- $Str .= '
';
#
+ $Str .= '';
$Str .= '';
- $Str .= ' 'x5;
- $Str .= 'Plot '.&plot_dropdown().(' 'x10);
+ $Str .= (' 'x10);
#
return $Str;
}
@@ -661,6 +675,11 @@ Main interface to problem statistics.
my $navmap;
my @sequences;
+sub clean_up {
+ undef($navmap);
+ undef(@sequences);
+}
+
sub BuildProblemStatisticsPage {
my ($r,$c)=@_;
undef($navmap);
@@ -669,6 +688,7 @@ sub BuildProblemStatisticsPage {
my %Saveable_Parameters = ('Status' => 'scalar',
'statsoutputmode' => 'scalar',
'Section' => 'array',
+ 'Groups' => 'array',
'StudentData' => 'array',
'Maps' => 'array',
'fieldselections'=> 'array');
@@ -686,7 +706,7 @@ sub BuildProblemStatisticsPage {
# Finally let the user know we are here
my $interface = &CreateInterface($r);
$r->print($interface);
- $r->print('');
#
my @CacheButtonHTML =
@@ -697,14 +717,15 @@ sub BuildProblemStatisticsPage {
}
#
$r->print($Str);
- if (! exists($ENV{'form.firstrun'})) {
+ if (! exists($env{'form.firstrun'})) {
$r->print('
'.
&mt('Press "Generate Statistics" when you are ready.').
'
'.
&mt('It may take some time to update the student data '.
'for the first analysis. Future analysis this session '.
- ' will not have this delay.').
+ 'will not have this delay.').
'