--- loncom/interface/statistics/lonproblemanalysis.pm 2003/10/13 19:17:42 1.33 +++ loncom/interface/statistics/lonproblemanalysis.pm 2003/10/13 21:12:56 1.34 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.33 2003/10/13 19:17:42 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.34 2003/10/13 21:12:56 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -308,21 +308,47 @@ sub time_analysis { my ($PerformanceData,$ORdata) = @_; my $num_plots = $ENV{'form.NumPlots'}; my ($table,@Foils) = &build_foil_index($ORdata); - my ($begin_index,$end_index); my $num_data = scalar(@$PerformanceData)-1; my $percent = sprintf('%2f',100/$num_plots); for (my $i=0;$i<$num_plots;$i++) { - $begin_index = $i*int($num_data/$num_plots); - $end_index = ($i+1)*int($num_data/$num_plots); - my $lownum = sprintf('%2.1f',$i*$percent); - $lownum =~ s/(\.0)$//; - my $highnum = sprintf('%2.1f',($i+1)*$percent); - $highnum =~ s/(\.0)$//; - my ($plothtml,$starttime,$endtime,$data) = + my $starttime = &Apache::lonhtmlcommon::get_date_from_form + ('startdate_'.$i); + my $endtime = &Apache::lonhtmlcommon::get_date_from_form + ('enddate_'.$i); + my ($begin_index,$end_index,$plottitle,$plothtml,$data); + if (! defined($starttime) || ! defined($endtime)) { + $begin_index = $i*int($num_data/$num_plots); + $end_index = ($i+1)*int($num_data/$num_plots); + my $lownum = sprintf('%2.1f',$i*$percent); + $lownum =~ s/(\.0)$//; + my $highnum = sprintf('%2.1f',($i+1)*$percent); + $highnum =~ s/(\.0)$//; + $plottitle = $lownum.'% to '.$highnum.'% of submissions'; + } else { + my $j; + while (++$j < scalar(@$PerformanceData)) { + last if ($PerformanceData->[$j]->[2] > $starttime); + } + $begin_index = $j; + while (++$j < scalar(@$PerformanceData)) { + last if ($PerformanceData->[$j]->[2] > $endtime); + } + $end_index = $j; + $plottitle = 'Tries plot '.$i; + } + + ($plothtml,$starttime,$endtime,$data) = &analyze_option_data_by_time($PerformanceData, $begin_index,$end_index, - $lownum.'% to '.$highnum.'% of submissions', + $plottitle, @Foils); + my $startdateform = &Apache::lonhtmlcommon::date_setter + ('Statistics','startdate_'.$i,$starttime); + my $enddateform = &Apache::lonhtmlcommon::date_setter + ('Statistics','enddate_'.$i,$endtime); + $plothtml.= "
\n". + "Start Time: "." ".$startdateform."
\n". + "End Time  : "." ".$enddateform."
\n"; $table.=$plothtml; } return $table; @@ -379,9 +405,6 @@ sub analyze_option_data_by_time { 'Percent Correct / Incorrect', 100, \@Plotdata1,\@Plotdata2); - $graphlink .= "
\n". - "Start Time: ".localtime($starttime)."
\n". - "End Time: ".localtime($endtime)."
\n"; # return ($graphlink,$starttime,$endtime,\%TimeData); }