--- loncom/interface/statistics/lonproblemanalysis.pm 2003/12/15 16:23:00 1.52
+++ loncom/interface/statistics/lonproblemanalysis.pm 2004/01/19 16:33:16 1.57
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemanalysis.pm,v 1.52 2003/12/15 16:23:00 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.57 2004/01/19 16:33:16 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,14 +42,19 @@ my $plotcolors = ['#33ff00',
'#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66',
];
-my @SubmitButtons = ({ name => 'ProblemAnalyis',
+my @SubmitButtons = ({ name => 'PrevProblemAnalysis',
+ text => 'Previous Problem' },
+ { name => 'ProblemAnalysis',
text => 'Analyze Problem Again' },
+ { name => 'NextProblemAnalysis',
+ text => 'Next Problem' },
+ { name => 'break'},
{ name => 'ClearCache',
text => 'Clear Caches' },
{ name => 'updatecaches',
text => 'Update Student Data' },
{ name => 'SelectAnother',
- text => 'Choose a different resource' },
+ text => 'Choose a different Problem' },
{ name => 'ExcelOutput',
text => 'Produce Excel Output' });
@@ -112,34 +117,54 @@ sub BuildProblemAnalysisPage {
if (exists($ENV{'form.problemchoice'}) &&
! exists($ENV{'form.SelectAnother'})) {
foreach my $button (@SubmitButtons) {
- $r->print('{'text'}).'" />');
- $r->print(' 'x5);
+ if ($button->{'name'} eq 'break') {
+ $r->print(" \n");
+ } else {
+ $r->print('{'text'}).'" />');
+ $r->print(' 'x5);
+ }
}
- $r->print('');
#
$r->print('
');
- #
- my ($symb,$part,$resid,$resptype) = &get_problem_symb(
- &Apache::lonnet::unescape($ENV{'form.problemchoice'}));
$r->rflush();
#
- my $resource = &get_resource_from_symb($symb);
- if (! defined($resource) || ! defined($resptype)) {
+ # Determine which problem we are to analyze
+ my $current_problem = &get_target_from_id($ENV{'form.problemchoice'});
+ #
+ my ($prev,$curr,$next) = &get_prev_curr_next($current_problem);
+ if (exists($ENV{'form.PrevProblemAnalysis'}) && defined($prev)) {
+ $current_problem = $prev;
+ } elsif (exists($ENV{'form.NextProblemAnalysis'}) && defined($next)) {
+ $current_problem = $next;
+ } else {
+ $current_problem = $curr;
+ }
+ #
+ # Store the current problem choice and send it out in the form
+ $ENV{'form.problemchoice'} = &make_target_id($current_problem);
+ $r->print('');
+ #
+ if (! defined($current_problem->{'resource'})) {
$r->print('resource is undefined');
} else {
+ my $resource = $current_problem->{'resource'};
$r->print('
'.
&mt('The analysis you have selected is not supported at this time').
@@ -197,7 +221,6 @@ sub RadioResponseAnalysis {
$r->print($analysis_html);
}
-
sub RR_Excel_output {
my ($r,$PerformanceData,$ProblemData) = @_;
return '
No!
';
@@ -209,7 +232,8 @@ sub RR_Tries_Analysis {
my $mintries = 1;
my $maxtries = $ENV{'form.NumPlots'};
my ($table,$Foils,$Concepts) = &build_foil_index($ProblemData);
- if ((@$Concepts < 2) && ($ENV{'form.AnalyzeAs'} ne 'Foils')) {
+ if ((! defined($Concepts)) || ((@$Concepts < 2) &&
+ ($ENV{'form.AnalyzeAs'} ne 'Foils'))) {
$table = '
'.
&mt('Not enough data for concept analysis. '.
'Performing Foil Analysis').
@@ -218,15 +242,15 @@ sub RR_Tries_Analysis {
}
$analysis_html .= $table;
my @TryData = &RR_tries_data_analysis($r,$PerformanceData);
- if ($ENV{'form.AnalyzeAs'} eq 'Foils') {
- $analysis_html = &RR_Tries_Foil_Analysis($mintries,$maxtries,$Foils,
+# if ($ENV{'form.AnalyzeAs'} eq 'Foils') {
+ $analysis_html .= &RR_Tries_Foil_Analysis($mintries,$maxtries,$Foils,
\@TryData,$ProblemData);
- } else {
- $analysis_html = &RR_Tries_Concept_Analysis($mintries,$maxtries,
- $Concepts,
- \@TryData,
- $ProblemData);
- }
+# } else {
+# $analysis_html = &RR_Tries_Concept_Analysis($mintries,$maxtries,
+# $Concepts,
+# \@TryData,
+# $ProblemData);
+# }
return $analysis_html;
}
@@ -256,8 +280,8 @@ sub RR_Tries_Foil_Analysis {
my @PlotData_Correct;
my @PlotData_Incorrect;
next if ($try > scalar(@{$TryData}));
- next if (! defined($TryData->[$try-1]));
- my %DataSet = %{$TryData->[$try-1]};
+ next if (! defined($TryData->[$try]));
+ my %DataSet = %{$TryData->[$try]};
my $total = 0;
foreach my $foilid (@$Foils) {
$total += $DataSet{$foilid};
@@ -288,7 +312,6 @@ sub RR_Tries_Foil_Analysis {
\@PlotData_Correct,
\@PlotData_Incorrect);
}
- &Apache::lonnet::logthis('plot = '.$html);
return $html;
}
@@ -311,14 +334,12 @@ sub RR_Time_Concept_Analysis {
}
-
sub get_Radio_problem_data {
my ($url) = @_;
my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze'));
(my $garbage,$Answ)=split('_HASH_REF__',$Answ,2);
my %Answer = &Apache::lonnet::str2hash($Answ);
my %Partdata;
- &Apache::lonnet::logthis('url = '.$url);
foreach my $part (@{$Answer{'parts'}}) {
while (my($key,$value) = each(%Answer)) {
# if (ref($value) eq 'ARRAY') {
@@ -344,9 +365,6 @@ sub get_Radio_problem_data {
return %Partdata;
}
-=cut
-
-
#########################################################
#########################################################
##
@@ -355,10 +373,13 @@ sub get_Radio_problem_data {
#########################################################
#########################################################
sub OptionResponseAnalysis {
- my ($r,$resource,$resid,$ProblemData,$Students) = @_;
+ my ($r,$problem,$ProblemData,$Students) = @_;
+ my ($resource,$respid) = ($problem->{'resource'},
+ $problem->{'respid'});
+ # Note: part data is not needed.
my $PerformanceData =
&Apache::loncoursedata::get_response_data
- ($Students,$resource->{'symb'},$resid);
+ ($Students,$resource->{'symb'},$respid);
if (! defined($PerformanceData) ||
ref($PerformanceData) ne 'ARRAY' ) {
$r->print('
'.
@@ -367,20 +388,20 @@ sub OptionResponseAnalysis {
} else {
$r->rflush();
if (exists($ENV{'form.ExcelOutput'})) {
- my $result = &prepare_optionresponse_excel_sheet($r,$resource,
- $PerformanceData,
- $ProblemData);
+ my $result = &OR_excel_sheet($r,$resource,
+ $PerformanceData,
+ $ProblemData);
$r->print($result);
$r->rflush();
} else {
if ($ENV{'form.AnalyzeOver'} eq 'Tries') {
- my $analysis_html = &tries_analysis($r,
+ my $analysis_html = &OR_tries_analysis($r,
$PerformanceData,
$ProblemData);
$r->print($analysis_html);
$r->rflush();
} elsif ($ENV{'form.AnalyzeOver'} eq 'Time') {
- my $analysis_html = &time_analysis($PerformanceData,
+ my $analysis_html = &OR_time_analysis($PerformanceData,
$ProblemData);
$r->print($analysis_html);
$r->rflush();
@@ -399,7 +420,7 @@ sub OptionResponseAnalysis {
# Option Response: Tries Analysis
#
#########################################################
-sub tries_analysis {
+sub OR_tries_analysis {
my ($r,$PerformanceData,$ORdata) = @_;
my $mintries = 1;
my $maxtries = $ENV{'form.NumPlots'};
@@ -411,21 +432,21 @@ sub tries_analysis {
'