--- loncom/interface/statistics/lonproblemanalysis.pm 2003/10/24 13:38:06 1.46 +++ loncom/interface/statistics/lonproblemanalysis.pm 2003/11/11 22:07:46 1.48 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.46 2003/10/24 13:38:06 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.48 2003/11/11 22:07:46 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -24,7 +24,6 @@ # # http://www.lon-capa.org/ # - package Apache::lonproblemanalysis; use strict; @@ -73,6 +72,7 @@ sub render_resource { sub BuildProblemAnalysisPage { my ($r,$c)=@_; + # $r->print('
'.
@@ -1254,15 +1452,28 @@ sub ProblemSelector {
next if ($res->{'type'} ne 'assessment');
foreach my $part (@{$res->{'parts'}}) {
my $partdata = $res->{'partdata'}->{$part};
- if (! exists($partdata->{'option'}) ||
- $partdata->{'option'} == 0) {
+# &Apache::lonnet::logthis('----------------');
+# 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;
}
for (my $i=0;$i | '. ''.$res->{'title'}.' '; +# ''.$resptype.' '.$res->{'title'}.' '; if ($partdata->{'option'} > 1) { $seq_str .= &mt('response').' '.$respid; } @@ -1297,8 +1509,9 @@ sub ProblemSelector { ######################################################### sub get_problem_symb { my $problemstring = shift(); - my ($symb,$partid,$resid) = ($problemstring=~ /^(.*):([^:]*):([^:]*)$/); - return ($symb,$partid,$resid); + my ($symb,$partid,$resid,$resptype) = + ($problemstring=~ /^(.*):([^:]*):([^:]*):([^:]*)$/); + return ($symb,$partid,$resid,$resptype); } sub get_resource_from_symb { @@ -1313,26 +1526,49 @@ sub get_resource_from_symb { return undef; } -sub get_time_from_OR_row { + +######################################################### +######################################################### +## +## Misc Option Response functions +## +######################################################### +######################################################### +sub get_time_from_row { my ($row) = @_; if (ref($row)) { - return $row->[4]; + return $row->[&Apache::loncoursedata::RD_timestamp()]; } return undef; } -sub get_tries_from_OR_row { +sub get_tries_from_row { my ($row) = @_; if (ref($row)) { - return $row->[5]; + return $row->[&Apache::loncoursedata::RD_tries()]; } return undef; } +sub hashify_attempt { + my ($row) = @_; + my %attempt; + $attempt{'tries'} = $row->[&Apache::loncoursedata::RD_tries()]; + $attempt{'submission'} = $row->[&Apache::loncoursedata::RD_submission()]; + $attempt{'award'} = $row->[&Apache::loncoursedata::RD_awarddetail()]; + $attempt{'timestamp'} = $row->[&Apache::loncoursedata::RD_timestamp()]; + return %attempt; +} + sub Process_OR_Row { my ($row) = @_; 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'); if ($award =~ /(APPROX_ANS|EXACT_ANS)/) { $RowData{'_correct'} = 1; @@ -1372,25 +1608,25 @@ sub get_problem_data { $key =~ s/^$part\.//; if (ref($value) eq 'ARRAY') { if ($key eq 'options') { - $Partdata{$part}->{'Options'}=$value; + $Partdata{$part}->{'_Options'}=$value; } elsif ($key eq 'concepts') { - $Partdata{$part}->{'Concepts'}=$value; + $Partdata{$part}->{'_Concepts'}=$value; } elsif ($key =~ /^concept\.(.*)$/) { my $concept = $1; foreach my $foil (@$value) { - $Partdata{$part}->{'Foils'}->{$foil}->{'Concept'}= + $Partdata{$part}->{'_Foils'}->{$foil}->{'_Concept'}= $concept; } } } else { if ($key=~ /^foil\.text\.(.*)$/) { my $foil = $1; - $Partdata{$part}->{'Foils'}->{$foil}->{'name'}=$foil; + $Partdata{$part}->{'_Foils'}->{$foil}->{'name'}=$foil; $value =~ s/(\s*$|^\s*)//g; - $Partdata{$part}->{'Foils'}->{$foil}->{'text'}=$value; + $Partdata{$part}->{'_Foils'}->{$foil}->{'text'}=$value; } elsif ($key =~ /^foil\.value\.(.*)$/) { my $foil = $1; - $Partdata{$part}->{'Foils'}->{$foil}->{'value'}=$value; + $Partdata{$part}->{'_Foils'}->{$foil}->{'value'}=$value; } } } @@ -1401,3 +1637,11 @@ sub get_problem_data { 1; __END__ + +##### +# partdata{part}->{_Foils}->{foilid}->{'name'} = $ +# ->{'text'} = $ +# ->{'value'} = $ +# ->{'_Concept'} = $ +# partdata{part}->{_Options} = @ +# partdata{part}->{_Concepts} = @ |