version 1.25, 2003/10/06 20:51:20
|
version 1.26, 2003/10/07 16:07:39
|
Line 46 sub BuildProblemAnalysisPage {
|
Line 46 sub BuildProblemAnalysisPage {
|
my ($symb,$part,$resid) = &get_problem_symb( |
my ($symb,$part,$resid) = &get_problem_symb( |
&Apache::lonnet::unescape($ENV{'form.problemchoice'}) |
&Apache::lonnet::unescape($ENV{'form.problemchoice'}) |
); |
); |
$r->print('<hr />'); |
|
my $resource = &get_resource_from_symb($symb); |
my $resource = &get_resource_from_symb($symb); |
if (defined($resource)) { |
if (defined($resource)) { |
my %Data = &get_problem_data($resource->{'src'}); |
my %Data = &get_problem_data($resource->{'src'}); |
my $ORdata = $Data{$part.'.'.$resid}; |
my $ORdata = $Data{$part.'.'.$resid}; |
## |
## |
## Render the problem for display |
## Render the problem |
my $base; |
my $base; |
($base,undef) = ($resource->{'src'} =~ m|(.*/)[^/]*$|); |
($base,undef) = ($resource->{'src'} =~ m|(.*/)[^/]*$|); |
$base = "http://".$ENV{'SERVER_NAME'}.$base; |
$base = "http://".$ENV{'SERVER_NAME'}.$base; |
$r->print('</form>'. |
my $rendered_problem = |
'<table bgcolor="ffffff"><tr><td>'. |
&Apache::lonnet::ssi_body($resource->{'src'}); |
|
$rendered_problem =~ s/<form /<nop /g; |
|
$rendered_problem =~ s/<\s*\/form\s>/<\/nop>/g; |
|
$r->print('<table bgcolor="ffffff"><tr><td>'. |
'<base href="'.$base.'" />'. |
'<base href="'.$base.'" />'. |
# &Apache::loncommon::get_student_view |
$rendered_problem. |
# ($symb,$ENV{'user.name'},$ENV{'user.domain'},$ENV{'request.course.id'},'web'). |
'</td></tr></table>'); |
&Apache::lonnet::ssi_body($resource->{'src'}). |
|
'</td></tr></table>'. |
|
'<form name="Statistics" method="post" action="/adm/statistics">'); |
|
## |
## |
## Analyze the problem |
## Analyze the problem |
my @Data = &Apache::loncoursedata::get_optionresponse_data |
my $PerformanceData = |
(undef,$symb,$resid); |
&Apache::loncoursedata::get_optionresponse_data |
my $analysis_html = &DoTriesAnalysis(\@Data,$ORdata); |
(undef,$symb,$resid); |
$r->print($analysis_html); |
if (defined($PerformanceData) && |
|
ref($PerformanceData) eq 'ARRAY') { |
|
my $analysis_html = &DoTriesAnalysis($PerformanceData,$ORdata); |
|
$r->print($analysis_html); |
|
} else { |
|
$r->print('<h2>'. |
|
&mt('There is no student data for this problem.'). |
|
'</h2>'); |
|
} |
} else { |
} else { |
$r->print('resource is undefined'); |
$r->print('resource is undefined'); |
} |
} |
$r->print('<ol>'); |
|
$r->print("<li /><strike>render problem</strike>\n"); |
|
$r->print("<li /><strike>Get student response data</strike>\n"); |
|
$r->print("<li />image tag for plot\n"); |
|
$r->print("<li />plot key\n"); |
|
$r->print('</ol>'); |
|
$r->print('<hr />'); |
$r->print('<hr />'); |
} else { |
} else { |
$r->print('<h3>No Problem Selected</h3>'); |
$r->print('<h3>No Problem Selected</h3>'); |
Line 89 sub BuildProblemAnalysisPage {
|
Line 90 sub BuildProblemAnalysisPage {
|
|
|
|
|
sub DoTriesAnalysis { |
sub DoTriesAnalysis { |
my ($Data,$ORdata) = @_; |
my ($PerformanceData,$ORdata) = @_; |
my $mintries = 1; |
my $mintries = 1; |
my $maxtries = 3; |
my $maxtries = 3; |
my %ResponseData = &analyze_option_data_by_tries($Data, |
my %ResponseData = &analyze_option_data_by_tries($PerformanceData, |
$mintries,$maxtries); |
$mintries,$maxtries); |
my @Foils = sort(keys(%ResponseData)); |
my @Foils = sort(keys(%ResponseData)); |
my %Row_Label; |
my %Row_Label; |
foreach my $foilid (@Foils) { |
foreach my $foilid (@Foils) { |
my $value = $ORdata->{'Foiltext'}->{$foilid}; |
my $value = $ORdata->{'Foiltext'}->{$foilid}; |
&Apache::lonnet::logthis('row label '.$foilid.' = '.$value); |
# &Apache::lonnet::logthis('row label '.$foilid.' = '.$value); |
$Row_Label{$foilid} = $ORdata->{'Foiltext'}->{$foilid}; |
$Row_Label{$foilid} = $ORdata->{'Foiltext'}->{$foilid}; |
} |
} |
my @Rows; |
my @Rows; |
Line 164 sub DoTriesAnalysis {
|
Line 165 sub DoTriesAnalysis {
|
} |
} |
|
|
sub analyze_option_data_by_tries { |
sub analyze_option_data_by_tries { |
my ($data,$mintries,$maxtries) = @_; |
my ($PerformanceData,$mintries,$maxtries) = @_; |
my %Trydata; |
my %Trydata; |
$mintries = 1 if (! defined($mintries) || $mintries < 1); |
$mintries = 1 if (! defined($mintries) || $mintries < 1); |
$maxtries = $mintries if (! defined($maxtries) || $maxtries < $mintries); |
$maxtries = $mintries if (! defined($maxtries) || $maxtries < $mintries); |
foreach my $row (@$data) { |
foreach my $row (@$PerformanceData) { |
|
next if (! defined($row)); |
my ($grading,$submission,$time,$tries) = @$row; |
my ($grading,$submission,$time,$tries) = @$row; |
my @Foilgrades = split('&',$grading); |
my @Foilgrades = split('&',$grading); |
my @Foilsubs = split('&',$submission); |
my @Foilsubs = split('&',$submission); |
Line 202 sub analyze_option_data_by_tries {
|
Line 204 sub analyze_option_data_by_tries {
|
|
|
sub DrawGraph { |
sub DrawGraph { |
my ($title,$xlabel,$ylabel,$MaxY,$values1,$values2)=@_; |
my ($title,$xlabel,$ylabel,$MaxY,$values1,$values2)=@_; |
|
if (! defined($values1) || ref($values1) ne 'ARRAY') { |
|
return ''; |
|
} |
$title = '' if (! defined($title)); |
$title = '' if (! defined($title)); |
$xlabel = '' if (! defined($xlabel)); |
$xlabel = '' if (! defined($xlabel)); |
$ylabel = '' if (! defined($ylabel)); |
$ylabel = '' if (! defined($ylabel)); |
Line 280 sub OptionResponseProblemSelector {
|
Line 285 sub OptionResponseProblemSelector {
|
my $seq_str = ''; |
my $seq_str = ''; |
foreach my $res (@{$seq->{'contents'}}) { |
foreach my $res (@{$seq->{'contents'}}) { |
# &Apache::lonnet::logthis('checking '.$res->{'title'}); |
# &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}; |
if (! exists($partdata->{'option'}) || |
if (! exists($partdata->{'option'}) || |
Line 359 sub get_problem_data {
|
Line 364 sub get_problem_data {
|
$Partdata{$part}->{$foil}->{'Concept'}=$concept; |
$Partdata{$part}->{$foil}->{'Concept'}=$concept; |
} |
} |
} |
} |
&Apache::lonnet::logthis($part.' '.$key.' (array) = '. |
# &Apache::lonnet::logthis($part.' '.$key.' (array) = '. |
join(', ',@$value)); |
# join(', ',@$value)); |
} else { |
} else { |
$value =~ s/^\s*//g; |
$value =~ s/^\s*//g; |
$value =~ s/\s*$//g; |
$value =~ s/\s*$//g; |
Line 371 sub get_problem_data {
|
Line 376 sub get_problem_data {
|
my $foil = $1; |
my $foil = $1; |
$Partdata{$part}->{'FoilValues'}->{$foil}=$value; |
$Partdata{$part}->{'FoilValues'}->{$foil}=$value; |
} |
} |
&Apache::lonnet::logthis($part.' '.$key.' = '.$value); |
# &Apache::lonnet::logthis($part.' '.$key.' = '.$value); |
} |
} |
} |
} |
} |
} |