\n";
#
- # Compute the data neccessary to make the plots
- my @PlotData;
- my @CumulativePlotData;
- foreach my $foilid (@Foils) {
- for (my $i=$mintries;$i<=$maxtries;$i++) {
+ 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++) {
+ 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') {
+ $restriction_function = sub {($_[0]->{'tries'} == $plot_num?1:0)};
+ $header_message = 'Attempt [_1]';
+ $stats_message =
+ '[_1] submissions, [_2] correct, [_3] incorrect';
+ $post_message = '';
+ $no_data_message = 'No data exists for attempt [_1]';
+ } else {
+ my $starttime = &Apache::lonhtmlcommon::get_date_from_form
+ ('startdate_'.$plot_num);
+ my $endtime = &Apache::lonhtmlcommon::get_date_from_form
+ ('enddate_'.$plot_num);
+ ($starttime,$endtime) = &ensure_start_end_times
+ ($starttime,$endtime,
+ &get_time_from_row($response_data->[0]),
+ &get_time_from_row($response_data->[-1]),
+ $plot_num);
+ $header_message = 'Data from [_2] to [_3]';
+ $extra_data[0] = &Apache::lonlocal::locallocaltime($starttime);
+ $extra_data[1] = &Apache::lonlocal::locallocaltime($endtime);
#
- # Gather the per-attempt data
- push (@{$PlotData[$i]->{'good'}},
- $ResponseData{$foilid}->[$i]->{'percent_corr'});
- push (@{$PlotData[$i]->{'bad'}},
- 100-$ResponseData{$foilid}->[$i]->{'percent_corr'});
+ $stats_message =
+ '[_1] submissions from [_4] students, [_2] correct, [_3] incorrect';
#
- # Someday we may need the cumulative data and I think
- # this is a neat way of computing it as we go along.
- push (@{$CumulativePlotData[$i]->{'good'}},
- $CumulativePlotData[-1]->{'good'}+
- $ResponseData{$foilid}->[$i]->{'correct'});
- push (@{$CumulativePlotData[$i]->{'bad'}},
- $CumulativePlotData[-1]->{'bad'}+
- $ResponseData{$foilid}->[$i]->{'incorrect'});
+ $post_message =
+ &mt('Start time: [_1]',
+ &Apache::lonhtmlcommon::date_setter
+ ('Statistics','startdate_'.$plot_num,$starttime)).
+ ' '.
+ &mt('End time: [_1]',
+ &Apache::lonhtmlcommon::date_setter
+ ('Statistics','enddate_'.$plot_num,$endtime));
+ $restriction_function =
+ sub {
+ my $t = $_[0]->{'timestamp'};
+ if ($t >= $starttime && $t < $endtime) {
+ return 1;
+ } else {
+ return 0;
+ }
+ };
+ $no_data_message = 'No data for [_2] to [_3]';
+ }
+ #
+ my ($correct,$answers) =
+ &numerical_determine_answers($r,$resource,$partid,
+ $respid,$students);
+ if ($c->aborted()) { return; };
+ #
+ my ($responses,$stats) =
+ &numerical_classify_responses($response_data,$correct,
+ $restriction_function);
+ if ($stats->{'submission_count'} == 0) {
+ $analysis_html.=
+ '