There are no students in the sections/groups selected
');
}
#
my @CacheButtonHTML =
&Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status');
$r->rflush();
#
- # Support for numerical and radio response isn't complete enough to
- # include in 1.2 release.
- # my $problem_types = '(option|radiobutton|numerical)';
- my $problem_types = '.';#(option)';
- if (exists($ENV{'form.problemchoice'}) &&
- ! exists($ENV{'form.SelectAnother'})) {
+ my $problem_types = '(option|radiobutton|numerical)';
+ if (exists($env{'form.problemchoice'}) &&
+ ! exists($env{'form.SelectAnother'})) {
foreach my $button (@SubmitButtons) {
if ($button->{'name'} eq 'break') {
$r->print(" \n");
@@ -102,44 +101,51 @@ sub BuildProblemAnalysisPage {
$r->print($html.(' 'x5));
}
#
+
+ # This is commented out pending actual implementation of
+ # CSV and Excel output.
+ #$r->print(&Apache::lonstathelpers::submission_report_form
+ # ('problem_analysis'));
+ #
$r->print('');
$r->rflush();
#
# Determine which problem we are to analyze
my $current_problem = &Apache::lonstathelpers::get_target_from_id
- ($ENV{'form.problemchoice'});
+ ($env{'form.problemchoice'});
#
- my ($prev,$curr,$next) =
+ my ($navmap,$prev,$curr,$next) =
&Apache::lonstathelpers::get_prev_curr_next($current_problem,
$problem_types,
'response',
);
- if (exists($ENV{'form.PrevProblemAnalysis'}) && defined($prev)) {
+ if (exists($env{'form.PrevProblemAnalysis'}) && defined($prev)) {
$current_problem = $prev;
- } elsif (exists($ENV{'form.NextProblemAnalysis'}) && defined($next)) {
+ } 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'} =
+ $env{'form.problemchoice'} =
&Apache::lonstathelpers::make_target_id($current_problem);
$r->print('');
+ $env{'form.problemchoice'}.'" />');
#
if (! defined($current_problem->{'resource'})) {
$r->print('resource is undefined');
} else {
my $resource = $current_problem->{'resource'};
- $r->print('
'.$resource->{'title'}.'
');
- $r->print('
'.$resource->{'src'}.'
');
- if ($ENV{'form.show_prob'} eq 'true') {
+ $r->print('
');
+ if ($env{'form.show_prob'} eq 'true') {
$r->print(&Apache::lonstathelpers::render_resource($resource));
}
$r->rflush();
my %Data = &Apache::lonstathelpers::get_problem_data
- ($resource->{'src'});
+ ($resource->src);
my $problem_data = $Data{$current_problem->{'part'}.
'.'.
$current_problem->{'respid'}};
@@ -160,12 +166,14 @@ sub BuildProblemAnalysisPage {
}
$r->print('');
} else {
- $r->print('');
+ my $submit_button = '';
+ $r->print($submit_button);
$r->print(' 'x5);
$r->print('
'.&mt('Please select a problem to analyze').'
');
- $r->print(&Apache::lonstathelpers::ProblemSelector
- ($problem_types));
+ $r->print(&Apache::lonstathelpers::problem_selector($problem_types,
+ $submit_button));
}
}
@@ -180,7 +188,7 @@ sub numerical_response_analysis {
my ($r,$problem,$problem_analysis,$students) = @_;
my $c = $r->connection();
#
- if ($ENV{'form.AnalyzeOver'} !~ /^(tries|time)$/) {
+ if ($env{'form.AnalyzeOver'} !~ /^(tries|time)$/) {
$r->print('Bad request');
}
#
@@ -189,9 +197,10 @@ sub numerical_response_analysis {
$problem->{'respid'});
# Gather student data
my $response_data = &Apache::loncoursedata::get_response_data
- (\@Apache::lonstatistics::SelectedSections,
+ ([&Apache::lonstatistics::get_selected_sections()],
+ [&Apache::lonstatistics::get_selected_groups()],
$Apache::lonstatistics::enrollment_status,
- $resource->{'symb'},$respid);
+ $resource->symb,$respid);
#
$problem_analysis->{'answercomputed'} = 1;
if ($problem_analysis->{'answercomputed'}) {
@@ -201,15 +210,22 @@ sub numerical_response_analysis {
'stats_status');
$r->print(&numerical_one_dimensional_plot($r,600,150,$answers));
}
+ #
+ if (ref($response_data) ne 'ARRAY') {
+ $r->print('
'.
+ &mt('There is no submission data for this resource').
+ '
');
+ return;
+ }
my $analysis_html = '
';
- for (my $plot_num = 1;$plot_num<=$ENV{'form.NumPlots'};$plot_num++) {
+ for (my $plot_num = 1;$plot_num<=$env{'form.NumPlots'};$plot_num++) {
my $restriction_function;
my $header_message;
my $stats_message;
my $post_message; # passed through &mt sooner rather than later
my $no_data_message;
my @extra_data;
- if ($ENV{'form.AnalyzeOver'} eq 'tries') {
+ if ($env{'form.AnalyzeOver'} eq 'tries') {
$restriction_function = sub {($_[0]->{'tries'} == $plot_num?1:0)};
$header_message = 'Attempt [_1]';
$stats_message =
@@ -253,15 +269,15 @@ sub numerical_response_analysis {
$no_data_message = 'No data for [_2] to [_3]';
}
#
- my ($correct,$intervals,$answers) =
- &numerical_response_determine_intervals($r,$resource,$partid,
- $respid,$students);
+ my ($correct,$answers) =
+ &numerical_determine_answers($r,$resource,$partid,
+ $respid,$students);
if ($c->aborted()) { return; };
#
- my $responses = &numerical_classify_responses($response_data,
- $correct,
- $restriction_function);
- if ($responses->{'_count'} == 0) {
+ my ($responses,$stats) =
+ &numerical_classify_responses($response_data,$correct,
+ $restriction_function);
+ if ($stats->{'submission_count'} == 0) {
$analysis_html.=
'
'.
&mt($no_data_message,$plot_num,@extra_data).
@@ -273,16 +289,16 @@ sub numerical_response_analysis {
'