version 1.13, 2002/11/22 04:04:10
|
version 1.18, 2002/12/13 21:39:19
|
Line 66 sub BuildProblemAnalysisPage {
|
Line 66 sub BuildProblemAnalysisPage {
|
$Ptr .= '</td></tr></table><br>'; |
$Ptr .= '</td></tr></table><br>'; |
$r->print($Ptr); |
$r->print($Ptr); |
$r->rflush(); |
$r->rflush(); |
|
# $r->print($cache{'OptionResponses'}.'<br>'); |
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache, $r)); |
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache, $r)); |
|
|
untie(%cache); |
untie(%cache); |
Line 90 sub BuildAnalyzePage {
|
Line 91 sub BuildAnalyzePage {
|
|
|
# Remove students who don't have the proper section. |
# Remove students who don't have the proper section. |
my @sectionsSelected = split(':',$cache{'sectionsSelected'}); |
my @sectionsSelected = split(':',$cache{'sectionsSelected'}); |
for(my $studentIndex=((scalar @$students)-1); $studentIndex>=0; |
|
|
my $studentCount = scalar @$students; |
|
for(my $studentIndex=$studentCount-1; $studentIndex>=0; |
$studentIndex--) { |
$studentIndex--) { |
my $value = $cache{$students->[$studentIndex].':section'}; |
my $value = $cache{$students->[$studentIndex].':section'}; |
my $found = 0; |
my $found = 0; |
Line 116 sub BuildAnalyzePage {
|
Line 119 sub BuildAnalyzePage {
|
$r->rflush(); |
$r->rflush(); |
} |
} |
|
|
|
&Apache::lonhtmlcommon::Close_PrgWin($r); |
|
|
|
### jason code for checing is there data in cache |
# my $error = |
# my $error = |
# &Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
# &Apache::loncoursedata::DownloadStudentCourseDataSeparate($students, |
# 'true', |
# 'true', |
Line 129 sub BuildAnalyzePage {
|
Line 135 sub BuildAnalyzePage {
|
# return; |
# return; |
# } |
# } |
|
|
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$Str .= 'Unable to tie database.'; |
$Str .= 'Unable to tie database.'; |
$r->print($Str); |
$r->print($Str); |
Line 141 sub BuildAnalyzePage {
|
Line 146 sub BuildAnalyzePage {
|
my $problem = $cache{$problemId.':problem'}; |
my $problem = $cache{$problemId.':problem'}; |
my $title = $cache{$problemId.':title'}; |
my $title = $cache{$problemId.':title'}; |
my $interval = $cache{'Interval'}; |
my $interval = $cache{'Interval'}; |
|
my $heading = 'Restore this particular Option Response Problem '. |
|
'Results, Please wait...'; |
|
|
my %ConceptData; |
my %ConceptData; |
$ConceptData{"Interval"} = $interval; |
$ConceptData{"Interval"} = $interval; |
Line 169 sub BuildAnalyzePage {
|
Line 176 sub BuildAnalyzePage {
|
$Str = ''; |
$Str = ''; |
if($c->aborted()) { untie(%cache); return; } |
if($c->aborted()) { untie(%cache); return; } |
|
|
|
&Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading); |
|
|
|
my $count=0; |
#Java script Progress window |
#Java script Progress window |
for(my $index=0; $index<(scalar @$students); $index++) { |
for(my $index=0; $index<(scalar @$students); $index++) { |
if($c->aborted()) { untie(%cache); return; } |
if($c->aborted()) { untie(%cache); return; } |
|
$count++; |
|
my $displayString = $count.'/'.$studentCount.': '.$_; |
|
&Apache::lonhtmlcommon::Update_PrgWin($displayString, $r); |
&OpStatus($problemId, $students->[$index], \%ConceptData, |
&OpStatus($problemId, $students->[$index], \%ConceptData, |
$analyzeData->{'foil_to_concept'}, $analyzeData, |
$analyzeData->{'foil_to_concept'}, $analyzeData, |
\%cache, $courseID); |
\%cache, $courseID); |
} |
} |
|
&Apache::lonhtmlcommon::Close_PrgWin($r); |
|
|
$Str .= '<br>'; |
$Str .= '<br>'; |
for (my $k=0; $k<$interval; $k++ ) { |
for (my $k=0; $k<$interval; $k++ ) { |
Line 290 sub OptionResponseTable {
|
Line 304 sub OptionResponseTable {
|
|
|
#---- Analyze Web Page ------------------------------------------------------- |
#---- Analyze Web Page ------------------------------------------------------- |
|
|
#restore the student submissions and finding the result |
# Joson code for reading data from cache |
=pod |
=pod |
sub OpStatus { |
sub OpStatus { |
my ($problemID, $student, $ConceptData, $foil_to_concept, |
my ($problemID, $student, $ConceptData, $foil_to_concept, |
Line 331 sub OpStatus {
|
Line 345 sub OpStatus {
|
} |
} |
=cut |
=cut |
|
|
|
|
|
#restore the student submissions and finding the result |
|
|
sub OpStatus { |
sub OpStatus { |
my ($problemID, $student, $ConceptData, $foil_to_concept, |
my ($problemID, $student, $ConceptData, $foil_to_concept, |
$analyzeData, $cache, $courseID)=@_; |
$analyzeData, $cache, $courseID)=@_; |
Line 344 sub OpStatus {
|
Line 361 sub OpStatus {
|
my $flag=0; |
my $flag=0; |
my $tries=0; |
my $tries=0; |
|
|
# $jr->print("<br> ID= $problemID <br> student= $student<br> prob= $symb<br>"); |
|
|
|
foreach my $id (@$ids) { |
foreach my $id (@$ids) { |
my ($part, $response) = split(/\./, $id); |
my ($part, $response) = split(/\./, $id); |
#=pod |
my %reshash=&Apache::lonnet::restore($symb,$courseID,$udom,$uname); |
my %reshash=&Apache::lonnet::restore($symb,$courseID,$udom,$uname); |
if ($reshash{'version'}) { |
if ($reshash{'version'}) { |
my $tries=0; |
my $tries=0; |
for (my $version=1;$version<=$reshash{'version'};$version++) { |
#&Apache::lonhomework::showhash(%$analyzeData); |
my $time=$reshash{"$version:timestamp"}; |
for (my $version=1;$version<=$reshash{'version'};$version++) { |
foreach my $key (sort(split(/\:/,$reshash{$version.':keys'}))) { |
my $time=$reshash{"$version:timestamp"}; |
if (($key=~/\.(\w+)\.(\w+)\.submission$/)) { |
|
my $Id1 = $1; my $Id2 = $2; |
foreach my $key (sort(split(/\:/,$reshash{$version.':keys'}))) { |
#check if this is a repeat submission, if so skip it |
if (($key=~/\.(\w+)\.(\w+)\.submission$/)) { |
if ($reshash{"$version:resource.$Id1.previous"}) { next; } |
my $Id1 = $1; my $Id2 = $2; |
#if no solved this wasn't a real submission, ignore it |
#check if this is a repeat submission, if so skip it |
if (!defined($reshash{"$version:resource.$Id1.solved"})) { |
if ($reshash{"$version:resource.$Id1.previous"}) { next; } |
&Apache::lonxml::debug("skipping "); |
#if no solved this wasn't a real submission, ignore it |
next; |
if (!defined($reshash{"$version:resource.$Id1.solved"})) { |
} |
&Apache::lonxml::debug("skipping "); |
my $Resp = $reshash{"$version:$key"}; |
next; |
my %submission=&Apache::lonnet::str2hash($Resp); |
} |
foreach (keys %submission) { |
my $Resp = $reshash{"$version:$key"}; |
my $Ansr = $analyzeData->{"$Id1.$Id2.foil.value.$_"}; |
my %submission=&Apache::lonnet::str2hash($Resp); |
if($submission{$_} eq $Ansr) { |
foreach (keys %submission) { |
|
my $Ansr = $analyzeData->{"$Id1.$Id2.foil.value.$_"}; |
|
if($submission{$_} eq $Ansr) { |
|
&Decide("true", $foil_to_concept->{$_}, |
&Decide("true", $foil_to_concept->{$_}, |
$time, $ConceptData); |
$time, $ConceptData); |
} else { |
} else { |
&Decide("false", $foil_to_concept->{$_}, |
&Decide("false", $foil_to_concept->{$_}, |
$time, $ConceptData); |
$time, $ConceptData); |
} |
} |
} |
} |
|
} |
} |
} |
} |
|
} |
|
} |
|
#=cut |
|
=pod |
|
my $time=$cache->{$student.':'.$problemID.':'.$part.':timestamp'}; |
|
my @submissions = split(':::', $cache->{$student.':'.$problemID.':'. |
|
$part.':'.$response. |
|
':submission'}); |
|
foreach my $Resp (@submissions) { |
|
my %submission=&Apache::lonnet::str2hash($Resp); |
|
foreach (keys(%submission)) { |
|
if($submission{$_}) { |
|
my $answer = $analyzeData->{$id.'.foil.value.'.$_}; |
|
if($submission{$_} eq $answer) { |
|
&Decide("true", $foil_to_concept->{$_}, |
|
$time, $ConceptData); |
|
} else { |
|
&Decide("false", $foil_to_concept->{$_}, |
|
$time, $ConceptData); |
|
} |
|
} |
|
} |
} |
} |
} |
=cut |
|
} |
} |
|
|
return; |
return; |
} |
} |
|
|
=pod |
|
sub OpStatus { |
|
my ($rid,$student,$ConceptData,$foil_to_concept,$analyzeData,$cache)=@_; |
|
my ($uname,$udom)=split(/\:/,$student); |
|
my $code='U'; |
|
$rid=~/(\d+)\.(\d+)/; |
|
my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. |
|
&Apache::lonnet::declutter($hash{'src_'.$rid}); |
|
my %reshash=&Apache::lonnet::restore($symb,$cid,$udom,$uname); |
|
my @True = (); |
|
my @False = (); |
|
my $flag=0; |
|
if ($reshash{'version'}) { |
|
my $tries=0; |
|
&Apache::lonhomework::showhash(%Answer); |
|
for (my $version=1;$version<=$reshash{'version'};$version++) { |
|
my $time=$reshash{"$version:timestamp"}; |
|
|
|
foreach my $key (sort(split(/\:/,$reshash{$version.':keys'}))) { |
|
if (($key=~/\.(\w+)\.(\w+)\.submission$/)) { |
|
my $Id1 = $1; my $Id2 = $2; |
|
#check if this is a repeat submission, if so skip it |
|
if ($reshash{"$version:resource.$Id1.previous"}) { next; } |
|
#if no solved this wasn't a real submission, ignore it |
|
if (!defined($reshash{"$version:resource.$Id1.solved"})) { |
|
&Apache::lonxml::debug("skipping "); |
|
next; |
|
} |
|
my $Resp = $reshash{"$version:$key"}; |
|
my %submission=&Apache::lonnet::str2hash($Resp); |
|
foreach (keys %submission) { |
|
my $Ansr = $Answer{"$Id1.$Id2.foil.value.$_"}; |
|
if ($submission{$_}) { |
|
if ($submission{$_} eq $Ansr) { |
|
&Decide("true",$_,$time ); |
|
} |
|
else {&Decide("false",$_,$time );} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
=cut |
|
|
|
sub DrawGraph { |
sub DrawGraph { |
my ($k,$Src,$Concepts,$ConceptData)=@_; |
my ($k,$Src,$Concepts,$ConceptData)=@_; |
Line 491 sub DrawGraph {
|
Line 436 sub DrawGraph {
|
$GData = $Titr.'&Concepts&Answers&'.$Max.'&'.$P_No.'&'; |
$GData = $Titr.'&Concepts&Answers&'.$Max.'&'.$P_No.'&'; |
$GData .= (join(',',@data1)).'&'.(join(',',@data2)); |
$GData .= (join(',',@data1)).'&'.(join(',',@data2)); |
|
|
return '<IMG src="/cgi-bin/graph.gif?'.$GData.'" border=1/>'; |
return '<IMG src="/cgi-bin/graph.png?'.$GData.'" border=1/>'; |
} |
} |
|
|
sub DrawTable { |
sub DrawTable { |