version 1.46, 2003/10/24 13:38:06
|
version 1.47, 2003/10/30 16:24:36
|
Line 108 sub BuildProblemAnalysisPage {
|
Line 108 sub BuildProblemAnalysisPage {
|
# |
# |
$r->print('<hr />'); |
$r->print('<hr />'); |
# |
# |
my ($symb,$part,$resid) = &get_problem_symb( |
my ($symb,$part,$resid,$resptype) = &get_problem_symb( |
&Apache::lonnet::unescape($ENV{'form.problemchoice'})); |
&Apache::lonnet::unescape($ENV{'form.problemchoice'})); |
$r->rflush(); |
$r->rflush(); |
# |
# |
my $resource = &get_resource_from_symb($symb); |
my $resource = &get_resource_from_symb($symb); |
if (! defined($resource)) { |
if (! defined($resource) || ! defined($resptype)) { |
$r->print('resource is undefined'); |
$r->print('resource is undefined'); |
} else { |
} else { |
$r->print('<h1>'.$resource->{'title'}.'</h1>'); |
$r->print('<h1>'.$resource->{'title'}.'</h1>'); |
$r->print('<h3>'.$resource->{'src'}.'</h3>'); |
$r->print('<h3>'.$resource->{'src'}.'</h3>'); |
|
$r->print(&render_resource($resource)); |
$r->rflush(); |
$r->rflush(); |
my %Data = &get_problem_data($resource->{'src'}); |
if ($resptype eq 'option') { |
my $ProblemData = $Data{$part.'.'.$resid}; |
my %Data = &get_OR_problem_data($resource->{'src'}); |
&OptionResponseAnalysis($r,$resource,$resid,$ProblemData, |
my $ProblemData = $Data{$part.'.'.$resid}; |
\@Students); |
&OptionResponseAnalysis($r,$resource,$resid,$ProblemData, |
|
\@Students); |
|
} elsif ($resptype eq 'radiobutton') { |
|
$r->print('<h2>This analysis is not supported</h2>'); |
|
my %Data = &get_Radio_problem_data($resource->{'src'}); |
|
my $ProblemData = $Data{$part.'.'.$resid}; |
|
&RadioResponseAnalysis($r,$resource,$resid,$ProblemData, |
|
\@Students); |
|
} else { |
|
$r->print('<h2>This analysis is not supported</h2>'); |
|
} |
} |
} |
$r->print('<hr />'); |
$r->print('<hr />'); |
} else { |
} else { |
Line 134 sub BuildProblemAnalysisPage {
|
Line 145 sub BuildProblemAnalysisPage {
|
} |
} |
} |
} |
|
|
|
|
|
######################################################### |
|
######################################################### |
|
## |
|
## Radio Response Routines |
|
## |
|
######################################################### |
|
######################################################### |
|
sub RadioResponseAnalysis { |
|
my ($r,$resource,$resid,$ProblemData,$Students) = @_; |
|
my $PerformanceData = |
|
&Apache::loncoursedata::get_response_data |
|
($Students,$resource->{'symb'},$resid); |
|
if (! ref($PerformanceData)) { |
|
$r->print('<h2>There is no submission data for this resource</h2>'); |
|
return; |
|
} |
|
# foreach my $row (@$PerformanceData) { |
|
# &Apache::lonnet::logthis('row = '.join(',',@$row)); |
|
# } |
|
return; |
|
} |
######################################################### |
######################################################### |
######################################################### |
######################################################### |
## |
## |
Line 143 sub BuildProblemAnalysisPage {
|
Line 176 sub BuildProblemAnalysisPage {
|
######################################################### |
######################################################### |
sub OptionResponseAnalysis { |
sub OptionResponseAnalysis { |
my ($r,$resource,$resid,$ProblemData,$Students) = @_; |
my ($r,$resource,$resid,$ProblemData,$Students) = @_; |
&Apache::lonnet::logthis('resid = '.$resid); |
|
my $PerformanceData = |
my $PerformanceData = |
&Apache::loncoursedata::get_optionresponse_data |
&Apache::loncoursedata::get_response_data |
($Students,$resource->{'symb'},$resid); |
($Students,$resource->{'symb'},$resid); |
if (! defined($PerformanceData) || |
if (! defined($PerformanceData) || |
ref($PerformanceData) ne 'ARRAY' ) { |
ref($PerformanceData) ne 'ARRAY' ) { |
Line 153 sub OptionResponseAnalysis {
|
Line 185 sub OptionResponseAnalysis {
|
&mt('There is no student data for this problem.'). |
&mt('There is no student data for this problem.'). |
'</h2>'); |
'</h2>'); |
} else { |
} else { |
$r->print(&render_resource($resource)); |
|
$r->rflush(); |
$r->rflush(); |
if (exists($ENV{'form.ExcelOutput'})) { |
if (exists($ENV{'form.ExcelOutput'})) { |
my $result = &prepare_optionresponse_excel_sheet($r,$resource, |
my $result = &prepare_optionresponse_excel_sheet($r,$resource, |
Line 368 sub analyze_option_data_by_tries {
|
Line 399 sub analyze_option_data_by_tries {
|
$maxtries = $mintries if (! defined($maxtries) || $maxtries < $mintries); |
$maxtries = $mintries if (! defined($maxtries) || $maxtries < $mintries); |
foreach my $row (@$PerformanceData) { |
foreach my $row (@$PerformanceData) { |
next if (! defined($row)); |
next if (! defined($row)); |
my $tries = &get_tries_from_OR_row($row); |
my $tries = &get_tries_from_row($row); |
my %Row = &Process_OR_Row($row); |
my %Row = &Process_OR_Row($row); |
next if (! %Row); |
next if (! %Row); |
while (my ($foilid,$href) = each(%Row)) { |
while (my ($foilid,$href) = each(%Row)) { |
Line 412 sub time_analysis {
|
Line 443 sub time_analysis {
|
('enddate_'.$i); |
('enddate_'.$i); |
if (! defined($starttime) || ! defined($endtime)) { |
if (! defined($starttime) || ! defined($endtime)) { |
my $sec_in_day = 86400; |
my $sec_in_day = 86400; |
my $last_sub_time = &get_time_from_OR_row($PerformanceData->[-1]); |
my $last_sub_time = &get_time_from_row($PerformanceData->[-1]); |
my ($sday,$smon,$syear); |
my ($sday,$smon,$syear); |
(undef,undef,undef,$sday,$smon,$syear) = |
(undef,undef,undef,$sday,$smon,$syear) = |
localtime($last_sub_time - $sec_in_day*$i); |
localtime($last_sub_time - $sec_in_day*$i); |
$starttime = &Time::Local::timelocal(0,0,0,$sday,$smon,$syear); |
$starttime = &Time::Local::timelocal(0,0,0,$sday,$smon,$syear); |
$endtime = $starttime + $sec_in_day; |
$endtime = $starttime + $sec_in_day; |
if ($i == ($num_plots -1 )) { |
if ($i == ($num_plots -1 )) { |
$starttime = &get_time_from_OR_row($PerformanceData->[0]); |
$starttime = &get_time_from_row($PerformanceData->[0]); |
} |
} |
} |
} |
my $startdateform = &Apache::lonhtmlcommon::date_setter |
my $startdateform = &Apache::lonhtmlcommon::date_setter |
Line 431 sub time_analysis {
|
Line 462 sub time_analysis {
|
my $end_index; |
my $end_index; |
my $j; |
my $j; |
while (++$j < scalar(@$PerformanceData)) { |
while (++$j < scalar(@$PerformanceData)) { |
last if (&get_time_from_OR_row($PerformanceData->[$j]) |
last if (&get_time_from_row($PerformanceData->[$j]) |
> $starttime); |
> $starttime); |
} |
} |
$begin_index = $j; |
$begin_index = $j; |
while (++$j < scalar(@$PerformanceData)) { |
while (++$j < scalar(@$PerformanceData)) { |
last if (&get_time_from_OR_row($PerformanceData->[$j]) > $endtime); |
last if (&get_time_from_row($PerformanceData->[$j]) > $endtime); |
} |
} |
$end_index = $j; |
$end_index = $j; |
## |
## |
Line 1254 sub ProblemSelector {
|
Line 1285 sub ProblemSelector {
|
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'}) || |
# &Apache::lonnet::logthis('----------------'); |
$partdata->{'option'} == 0) { |
# while (my ($k,$v)=each(%$partdata)) { |
|
# if (ref($v) eq 'ARRAY') { |
|
# &Apache::lonnet::logthis($k.' = '.join(',',@$v)); |
|
# } else { |
|
# &Apache::lonnet::logthis($k.' = '.$v); |
|
# } |
|
# } |
|
if ((! exists($partdata->{'option'}) || |
|
$partdata->{'option'} == 0 ) && |
|
(! exists($partdata->{'radiobutton'}) || |
|
$partdata->{'radiobutton'} == 0)) { |
next; |
next; |
} |
} |
for (my $i=0;$i<scalar(@{$partdata->{'ResponseTypes'}});$i++){ |
for (my $i=0;$i<scalar(@{$partdata->{'ResponseTypes'}});$i++){ |
my $respid = $partdata->{'ResponseIds'}->[$i]; |
my $respid = $partdata->{'ResponseIds'}->[$i]; |
my $resptype = $partdata->{'ResponseTypes'}->[$i]; |
my $resptype = $partdata->{'ResponseTypes'}->[$i]; |
if ($resptype eq 'option') { |
if ($resptype eq 'option' || $resptype eq 'radiobutton') { |
my $value = &Apache::lonnet::escape($res->{'symb'}.':'.$part.':'.$respid); |
my $value = &Apache::lonnet::escape($res->{'symb'}.':'.$part.':'.$respid.':'.$resptype); |
my $checked = ''; |
my $checked = ''; |
if ($ENV{'form.problemchoice'} eq $value) { |
if ($ENV{'form.problemchoice'} eq $value) { |
$checked = 'checked '; |
$checked = 'checked '; |
Line 1270 sub ProblemSelector {
|
Line 1311 sub ProblemSelector {
|
$seq_str .= '<tr><td>'. |
$seq_str .= '<tr><td>'. |
'<input type="radio" name="problemchoice" value="'.$value.'" '.$checked.'/>'. |
'<input type="radio" name="problemchoice" value="'.$value.'" '.$checked.'/>'. |
'</td><td>'. |
'</td><td>'. |
'<a href="'.$res->{'src'}.'">'.$res->{'title'}.'</a> '; |
'<a href="'.$res->{'src'}.'">'.$resptype.' '.$res->{'title'}.'</a> '; |
if ($partdata->{'option'} > 1) { |
if ($partdata->{'option'} > 1) { |
$seq_str .= &mt('response').' '.$respid; |
$seq_str .= &mt('response').' '.$respid; |
} |
} |
Line 1297 sub ProblemSelector {
|
Line 1338 sub ProblemSelector {
|
######################################################### |
######################################################### |
sub get_problem_symb { |
sub get_problem_symb { |
my $problemstring = shift(); |
my $problemstring = shift(); |
my ($symb,$partid,$resid) = ($problemstring=~ /^(.*):([^:]*):([^:]*)$/); |
my ($symb,$partid,$resid,$resptype) = |
return ($symb,$partid,$resid); |
($problemstring=~ /^(.*):([^:]*):([^:]*):([^:]*)$/); |
|
return ($symb,$partid,$resid,$resptype); |
} |
} |
|
|
sub get_resource_from_symb { |
sub get_resource_from_symb { |
Line 1313 sub get_resource_from_symb {
|
Line 1355 sub get_resource_from_symb {
|
return undef; |
return undef; |
} |
} |
|
|
sub get_time_from_OR_row { |
|
|
######################################################### |
|
######################################################### |
|
## |
|
## Misc Option Response functions |
|
## |
|
######################################################### |
|
######################################################### |
|
sub get_time_from_row { |
my ($row) = @_; |
my ($row) = @_; |
if (ref($row)) { |
if (ref($row)) { |
return $row->[4]; |
return $row->[&Apache::loncoursedata::RD_timestamp()]; |
} |
} |
return undef; |
return undef; |
} |
} |
|
|
sub get_tries_from_OR_row { |
sub get_tries_from_row { |
my ($row) = @_; |
my ($row) = @_; |
if (ref($row)) { |
if (ref($row)) { |
return $row->[5]; |
return $row->[&Apache::loncoursedata::RD_tries()]; |
} |
} |
return undef; |
return undef; |
} |
} |
Line 1332 sub get_tries_from_OR_row {
|
Line 1382 sub get_tries_from_OR_row {
|
sub Process_OR_Row { |
sub Process_OR_Row { |
my ($row) = @_; |
my ($row) = @_; |
my %RowData; |
my %RowData; |
my ($student_id,$award,$grading,$submission,$time,$tries) = @$row; |
my $student_id = $row->[&Apache::loncoursedata::RD_student_id()]; |
|
my $award = $row->[&Apache::loncoursedata::RD_awarddetail()]; |
|
my $grading = $row->[&Apache::loncoursedata::RD_response_eval()]; |
|
my $submission = $row->[&Apache::loncoursedata::RD_submission()]; |
|
my $time = $row->[&Apache::loncoursedata::RD_timestamp()]; |
|
my $tries = $row->[&Apache::loncoursedata::RD_tries()]; |
return undef if ($award eq 'MISSING_ANSWER'); |
return undef if ($award eq 'MISSING_ANSWER'); |
if ($award =~ /(APPROX_ANS|EXACT_ANS)/) { |
if ($award =~ /(APPROX_ANS|EXACT_ANS)/) { |
$RowData{'_correct'} = 1; |
$RowData{'_correct'} = 1; |
Line 1359 sub Process_OR_Row {
|
Line 1414 sub Process_OR_Row {
|
## note: we must force each foil and option to not begin or end with |
## note: we must force each foil and option to not begin or end with |
## spaces as they are stored without such data. |
## spaces as they are stored without such data. |
## |
## |
sub get_problem_data { |
sub get_OR_problem_data { |
my ($url) = @_; |
my ($url) = @_; |
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); |
Line 1395 sub get_problem_data {
|
Line 1450 sub get_problem_data {
|
} |
} |
} |
} |
} |
} |
|
return %Partdata; |
|
} |
|
|
|
######################################################### |
|
######################################################### |
|
## |
|
## Misc Radio Response functions |
|
## |
|
######################################################### |
|
######################################################### |
|
sub get_Radio_problem_student_data { |
|
my ($row) = @_; |
|
} |
|
|
|
sub get_Radio_problem_data { |
|
my ($url) = @_; |
|
my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze')); |
|
(my $garbage,$Answ)=split(/_HASH_REF__/,$Answ,2); |
|
my %Answer; |
|
%Answer=&Apache::lonnet::str2hash($Answ); |
|
my %Partdata; |
|
&Apache::lonnet::logthis('url = '.$url); |
|
foreach my $part (@{$Answer{'parts'}}) { |
|
while (my($key,$value) = each(%Answer)) { |
|
if (ref($value) eq 'ARRAY') { |
|
&Apache::lonnet::logthis('is ref part:'.$part.' '.$key.'='.join(',',@$value)); |
|
} else { |
|
&Apache::lonnet::logthis('notref part:'.$part.' '.$key.'='.$value); |
|
} |
|
next if ($key !~ /^$part/); |
|
$key =~ s/^$part\.//; |
|
if ($key eq 'foils') { |
|
$Partdata{$part}->{'_Foils'}=$value; |
|
} elsif ($key eq 'options') { |
|
$Partdata{$part}->{'_Options'}=$value; |
|
} elsif ($key eq 'shown') { |
|
$Partdata{$part}->{'_Shown'}=$value; |
|
} elsif ($key =~ /^foil.value.(.*)$/) { |
|
$Partdata{$part}->{$1}->{'value'}=$value; |
|
} elsif ($key =~ /^foil.text.(.*)$/) { |
|
$Partdata{$part}->{$1}->{'text'}=$value; |
|
} |
|
} |
|
} |
return %Partdata; |
return %Partdata; |
} |
} |
|
|