version 1.36, 2003/10/14 20:20:40
|
version 1.37, 2003/10/14 21:58:25
|
Line 35 use Apache::lonhtmlcommon();
|
Line 35 use Apache::lonhtmlcommon();
|
use Apache::loncoursedata(); |
use Apache::loncoursedata(); |
use Apache::lonstatistics; |
use Apache::lonstatistics; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use HTML::Entities(); |
|
|
sub BuildProblemAnalysisPage { |
sub BuildProblemAnalysisPage { |
my ($r,$c)=@_; |
my ($r,$c)=@_; |
Line 385 sub time_analysis {
|
Line 386 sub time_analysis {
|
my ($table,$Foils,$Concepts) = &build_foil_index($ORdata); |
my ($table,$Foils,$Concepts) = &build_foil_index($ORdata); |
my $num_data = scalar(@$PerformanceData)-1; |
my $num_data = scalar(@$PerformanceData)-1; |
my $percent = sprintf('%2f',100/$num_plots); |
my $percent = sprintf('%2f',100/$num_plots); |
|
$table .= "<table>\n"; |
for (my $i=0;$i<$num_plots;$i++) { |
for (my $i=0;$i<$num_plots;$i++) { |
my $starttime = &Apache::lonhtmlcommon::get_date_from_form |
my $starttime = &Apache::lonhtmlcommon::get_date_from_form |
('startdate_'.$i); |
('startdate_'.$i); |
Line 409 sub time_analysis {
|
Line 411 sub time_analysis {
|
last if ($PerformanceData->[$j]->[2] > $endtime); |
last if ($PerformanceData->[$j]->[2] > $endtime); |
} |
} |
$end_index = $j; |
$end_index = $j; |
$plottitle = 'Tries plot '.($i+1); |
$plottitle = $ENV{'form.plottitle_'.$i}; |
} |
} |
($plothtml,$starttime,$endtime,$data) = |
($plothtml,$starttime,$endtime,$data) = |
&analyze_option_data_by_time($PerformanceData, |
&analyze_option_data_by_time($PerformanceData, |
$begin_index,$end_index, |
$begin_index,$end_index, |
$plottitle, |
$plottitle, |
@$Foils); |
@$Concepts); |
my $startdateform = &Apache::lonhtmlcommon::date_setter |
my $startdateform = &Apache::lonhtmlcommon::date_setter |
('Statistics','startdate_'.$i,$starttime); |
('Statistics','startdate_'.$i,$starttime); |
my $enddateform = &Apache::lonhtmlcommon::date_setter |
my $enddateform = &Apache::lonhtmlcommon::date_setter |
('Statistics','enddate_'.$i,$endtime); |
('Statistics','enddate_'.$i,$endtime); |
$plothtml.= "<br />\n". |
$table.="<tr><td>".$plothtml.'</td><td align="left" valign="top">'. |
"<b>Start Time</b>: "." ".$startdateform."<br />\n". |
"<b>Start Time</b>: ".$startdateform."<br />". |
"<b>End Time</b> : "." ".$enddateform."<br />\n"; |
"<b>End Time</b> : "." ".$enddateform."<br />". |
$table.=$plothtml; |
'<b>Plot Title</b> :'. |
|
'<input type="text" size="30" name="plottitle_'.$i.'" value="'. |
|
&HTML::Entities::encode($plottitle).'" /><br />'. |
|
"</td></tr>\n"; |
} |
} |
|
$table .="</table>\n"; |
return $table; |
return $table; |
} |
} |
|
|
sub analyze_option_data_by_time { |
sub analyze_option_data_by_time { |
my ($PerformanceData,$begin_index,$end_index,$description,@Foils) = @_; |
my ($PerformanceData,$begin_index,$end_index,$description,@Concepts) = @_; |
my %TimeData; |
my %TimeData; |
# |
# |
# Get the start and end times for this segment of the plot |
# Get the start and end times for this segment of the plot |
Line 456 sub analyze_option_data_by_time {
|
Line 462 sub analyze_option_data_by_time {
|
# Compute the total and percent correct |
# Compute the total and percent correct |
my @Plotdata1; |
my @Plotdata1; |
my @Plotdata2; |
my @Plotdata2; |
foreach my $foilid (@Foils) { |
foreach my $concept (@Concepts) { |
if (! exists($TimeData{$foilid}->{'correct'})) { |
my ($correct,$incorrect,$total); |
$TimeData{$foilid}->{'correct'} = 0; |
foreach my $foilid (@{$concept->{'foils'}}) { |
|
if (! exists($TimeData{$foilid}->{'correct'})) { |
|
$TimeData{$foilid}->{'correct'} = 0; |
|
} |
|
if (! exists($TimeData{$foilid}->{'incorrect'})) { |
|
$incorrect = 0; |
|
$TimeData{$foilid}->{'incorrect'} = 0; |
|
} |
|
$correct += $TimeData{$foilid}->{'correct'}; |
|
$incorrect += $TimeData{$foilid}->{'incorrect'}; |
|
$total += $TimeData{$foilid}->{'correct'}+ |
|
$TimeData{$foilid}->{'incorrect'}; |
|
$TimeData{$foilid}->{'total'} = $TimeData{$foilid}->{'correct'} + |
|
$TimeData{$foilid}->{'incorrect'}; |
|
my $percent; |
|
if ($TimeData{$foilid}->{'total'} == 0) { |
|
$percent = 0; |
|
} else { |
|
$percent = $TimeData{$foilid}->{'correct'} / |
|
$TimeData{$foilid}->{'total'}; |
|
} |
|
$TimeData{$foilid}->{'percent_corr'} = 100 * $percent; |
|
if ($ENV{'form.AnalyzeAs'} eq 'Foils') { |
|
push (@Plotdata1, $TimeData{$foilid}->{'percent_corr'}); |
|
push (@Plotdata2,100-$TimeData{$foilid}->{'percent_corr'}); |
|
} |
} |
} |
if (! exists($TimeData{$foilid}->{'incorrect'})) { |
if ($ENV{'form.AnalyzeAs'} ne 'Foils') { |
$TimeData{$foilid}->{'incorrect'} = 0; |
if ($total == 0) { |
|
push (@Plotdata1,0); |
|
push (@Plotdata2,100); |
|
} else { |
|
push (@Plotdata1,100 * $correct / $total); |
|
push (@Plotdata2,100 * (1-$correct / $total)); |
|
} |
} |
} |
$TimeData{$foilid}->{'total'} = $TimeData{$foilid}->{'correct'} + |
|
$TimeData{$foilid}->{'incorrect'}; |
|
$TimeData{$foilid}->{'percent_corr'} = 100 * |
|
$TimeData{$foilid}->{'correct'} / |
|
$TimeData{$foilid}->{'total'}; |
|
push (@Plotdata1, $TimeData{$foilid}->{'percent_corr'}); |
|
push (@Plotdata2,100-$TimeData{$foilid}->{'percent_corr'}); |
|
} |
} |
# |
# |
# Create the plot |
# Create the plot |
|
my $xlabel; |
|
if ($ENV{'form.AnalyzeAs'} eq 'Foils') { |
|
$xlabel = 'Foil Number'; |
|
} else { |
|
$xlabel = 'Concept Number'; |
|
} |
my $graphlink = &Apache::loncommon::DrawGraph |
my $graphlink = &Apache::loncommon::DrawGraph |
($description,#'Time Interval Analysis', |
($description,#'Time Interval Analysis', |
'Foil Number', |
$xlabel, |
'Percent Correct / Incorrect', |
'Percent Correct / Incorrect', |
100, |
100, |
\@Plotdata1,\@Plotdata2); |
\@Plotdata1,\@Plotdata2); |
Line 592 sub OptionResponseProblemSelector {
|
Line 628 sub OptionResponseProblemSelector {
|
next if ($seq->{'num_assess'}<1); |
next if ($seq->{'num_assess'}<1); |
my $seq_str = ''; |
my $seq_str = ''; |
foreach my $res (@{$seq->{'contents'}}) { |
foreach my $res (@{$seq->{'contents'}}) { |
# &Apache::lonnet::logthis('checking '.$res->{'title'}); |
|
next if ($res->{'type'} ne 'assessment'); |
next if ($res->{'type'} ne 'assessment'); |
foreach my $part (@{$res->{'parts'}}) { |
foreach my $part (@{$res->{'parts'}}) { |
my $partdata = $res->{'partdata'}->{$part}; |
my $partdata = $res->{'partdata'}->{$part}; |
Line 657 sub get_resource_from_symb {
|
Line 692 sub get_resource_from_symb {
|
|
|
sub get_problem_data { |
sub get_problem_data { |
my ($url) = @_; |
my ($url) = @_; |
# my $Answ=&Apache::lonnet::ssi($URI,('grade_target' => 'analyze', |
|
# 'grade_username' => $sname, |
|
# 'grade_domain' => $sdom, |
|
# 'grade_courseid' => $cid, |
|
# 'grade_symb' => $symb)); |
|
my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze')); |
my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze')); |
(my $garbage,$Answ)=split(/_HASH_REF__/,$Answ,2); |
(my $garbage,$Answ)=split(/_HASH_REF__/,$Answ,2); |
my %Answer; |
my %Answer; |
%Answer=&Apache::lonnet::str2hash($Answ); |
%Answer=&Apache::lonnet::str2hash($Answ); |
# &Apache::lonnet::logthis('keys of %Answer = '.join(', ',(keys(%Answer)))); |
|
# &Apache::lonnet::logthis('$Answer{parts} = '. |
|
# join(', ',@{$Answer{'parts'}})); |
|
my %Partdata; |
my %Partdata; |
foreach my $part (@{$Answer{'parts'}}) { |
foreach my $part (@{$Answer{'parts'}}) { |
while (my($key,$value) = each(%Answer)) { |
while (my($key,$value) = each(%Answer)) { |
Line 677 sub get_problem_data {
|
Line 704 sub get_problem_data {
|
if (ref($value) eq 'ARRAY') { |
if (ref($value) eq 'ARRAY') { |
if ($key eq 'options') { |
if ($key eq 'options') { |
$Partdata{$part}->{'Options'}=$value; |
$Partdata{$part}->{'Options'}=$value; |
&Apache::lonnet::logthis('Options = '.join(', ',@$value)); |
|
} elsif ($key eq 'concepts') { |
} elsif ($key eq 'concepts') { |
$Partdata{$part}->{'Concepts'}=$value; |
$Partdata{$part}->{'Concepts'}=$value; |
} elsif ($key =~ /^concept\.(.*)$/) { |
} elsif ($key =~ /^concept\.(.*)$/) { |
Line 687 sub get_problem_data {
|
Line 713 sub get_problem_data {
|
$concept; |
$concept; |
} |
} |
} |
} |
# &Apache::lonnet::logthis($part.' '.$key.' (array) = '. |
|
# join(', ',@$value)); |
|
} else { |
} else { |
$value =~ s/^\s*//g; |
$value =~ s/^\s*//g; |
$value =~ s/\s*$//g; |
$value =~ s/\s*$//g; |
Line 700 sub get_problem_data {
|
Line 724 sub get_problem_data {
|
my $foil = $1; |
my $foil = $1; |
$Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; |
$Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; |
} |
} |
# &Apache::lonnet::logthis($part.' '.$key.' = '.$value); |
|
} |
} |
} |
} |
} |
} |
|
|
# my $parts=''; |
|
# foreach my $elm (@{$Answer{"parts"}}) { |
|
# $parts.="$elm,"; |
|
# } |
|
# chop($parts); |
|
# my $conc=''; |
|
# foreach my $elm (@{$Answer{"$parts.concepts"}}) { |
|
# $conc.="$elm@"; |
|
# } |
|
# chop($conc); |
|
# |
|
# @Concepts=split(/\@/,$conc); |
|
# foreach my $concept (@{$Answer{"$parts.concepts"}}) { |
|
# foreach my $foil (@{$Answer{"$parts.concept.$concept"}}) { |
|
# $foil_to_concept{$foil} = $concept; |
|
# #$ConceptData{$foil} = $Answer{"$parts.foil.value.$foil"}; |
|
# } |
|
# } |
|
# return $symb; |
|
return %Partdata; |
return %Partdata; |
} |
} |
|
|