version 1.3, 2001/02/05 18:58:04
|
version 1.6, 2001/09/08 19:16:01
|
Line 14
|
Line 14
|
# 3/1/1,6/1,17/1,29/1,30/1 Gerd Kortemeyer) |
# 3/1/1,6/1,17/1,29/1,30/1 Gerd Kortemeyer) |
# |
# |
# 1/31 Gerd Kortemeyer |
# 1/31 Gerd Kortemeyer |
|
# |
|
# 7/10/01 Behrouz Minaei |
|
# 9/8 Gerd Kortemeyer |
|
|
package Apache::lonchart; |
package Apache::lonchart; |
|
|
Line 31 my @students;
|
Line 34 my @students;
|
|
|
# ------------------------------------------------------------- Find out status |
# ------------------------------------------------------------- Find out status |
|
|
sub astatus { |
sub ExtractStudentData { |
my ($rid,$student)=@_; |
my ($index,$coid)=@_; |
my ($uname,$udom)=split(/\:/,$student); |
my ($sname,$sdom) = split( /\:/, $students[$index] ); |
my $code=' '; |
my $shome=&Apache::lonnet::homeserver( $sname,$sdom ); |
$rid=~/(\d+)\.(\d+)/; |
my $reply=&Apache::lonnet::reply('dump:'.$sdom.':'.$sname.':'.$coid,$shome ); |
my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. |
my %result=(); |
&Apache::lonnet::declutter($hash{'src_'.$rid}); |
my $ResId; |
my $answer=&Apache::lonnet::reply( |
my $Code; |
"restore:$udom:$uname:". |
my $Tries; |
$ENV{'request.course.id'}.':'. |
my $Wrongs; |
&Apache::lonnet::escape($symb), |
my $Version; |
&Apache::lonnet::homeserver($uname,$udom)); |
|
my %returnhash=(); |
my $Str=substr($students[$index]. |
map { |
' ',0,14).' ! '. |
my ($name,$value)=split(/\=/,$_); |
substr($rowlabels[$index]. |
$returnhash{&Apache::lonnet::unescape($name)}= |
' ',0,45).' ! '; |
&Apache::lonnet::unescape($value); |
|
} split(/\&/,$answer); |
unless ($reply=~/^error\:/) { |
if ($returnhash{'version'}) { |
map { |
my $version; |
my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_)); |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
$result{$name}=$value; |
map { |
} split(/\&/,$reply); |
$returnhash{$_}=$returnhash{$version.':'.$_}; |
foreach $ResId (@cols) { |
} split(/\:/,$returnhash{$version.':keys'}); |
if ( !$ResId ) { $Str .= ' ! '; next; } |
} |
$ResId=~/(\d+)\.(\d+)/; |
my $totaltries=0; |
my $Prob = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ). |
map { |
'___'.$2.'___'. |
if (($_=~/\.(\w+)\.solved$/) && ($_!~/^\d+\:/)) { |
&Apache::lonnet::declutter( $hash{'src_'.$ResId} ); |
my $part=$1; |
$Code=' '; |
if ($returnhash{$_} eq 'correct_by_student') { |
$Tries = 0; |
unless (($code eq '.') || ($code eq '-')) { $code='*'; } |
$Version = $result{"version:$Prob"}; |
$totaltries+=$returnhash{'resource.'.$part.'.tries'}; |
if ( $Version ) { |
} elsif ($returnhash{$_} eq 'correct_by_override') { |
my $vkeys = $result{"$Version:keys:$Prob"}; |
unless (($code eq '.') || ($code eq '-')) { $code='+'; } |
my @keys = split(/:/,$vkeys); |
} elsif ($returnhash{$_} eq 'incorrect_attempted') { |
foreach my $Key (@keys) { |
$code='.'; |
if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) { |
} elsif ($returnhash{$_} eq 'incorrect_by_override') { |
my $Part = $1; |
$code='-'; |
$Tries = $result{"$Version:$Prob:resource.$Part.tries"}; |
} elsif ($returnhash{$_} eq 'excused') { |
my $Val = $result{"$Version:$Prob:$Key"}; |
unless (($code eq '.') || ($code eq '-')) { $code='x'; } |
if ($Val eq 'correct_by_student'){$Code='*';} |
} |
elsif ($Val eq 'correct_by_override'){$Code = '+';} |
} |
elsif ($Val eq 'incorrect_attempted'){$Code = '.';} |
} keys %returnhash; |
elsif ($Val eq 'incorrect_by_override'){$Code = '-';} |
if (($code eq '*') && ($totaltries<10)) { $code="$totaltries"; } |
elsif ($Val eq 'excused'){$Code = 'x';} |
|
} |
|
if (($Code eq '*')&&($Tries<10)){$Code=$Tries;} |
|
} |
|
} |
|
$Str .= $Code; |
|
} |
} |
} |
return $code; |
return $Str; |
} |
} |
|
|
|
#sub astatus { |
|
# my ($rid,$student)=@_; |
|
# my ($uname,$udom)=split(/\:/,$student); |
|
# my $code=' '; |
|
# $rid=~/(\d+)\.(\d+)/; |
|
# my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. |
|
# &Apache::lonnet::declutter($hash{'src_'.$rid}); |
|
# my $answer=&Apache::lonnet::reply( |
|
# "restore:$udom:$uname:". |
|
# $ENV{'request.course.id'}.':'. |
|
# &Apache::lonnet::escape($symb), |
|
# &Apache::lonnet::homeserver($uname,$udom)); |
|
# my %returnhash=(); |
|
# map { |
|
# my ($name,$value)=split(/\=/,$_); |
|
# $returnhash{&Apache::lonnet::unescape($name)}= |
|
# &Apache::lonnet::unescape($value); |
|
# } split(/\&/,$answer); |
|
# if ($returnhash{'version'}) { |
|
# my $version; |
|
# for ($version=1;$version<=$returnhash{'version'};$version++) { |
|
# map { |
|
# $returnhash{$_}=$returnhash{$version.':'.$_}; |
|
# } split(/\:/,$returnhash{$version.':keys'}); |
|
# } |
|
# my $totaltries=0; |
|
# map { |
|
# if (($_=~/\.(\w+)\.solved$/) && ($_!~/^\d+\:/)) { |
|
# my $part=$1; |
|
# if ($returnhash{$_} eq 'correct_by_student') { |
|
# unless (($code eq '.') || ($code eq '-')) { $code='*'; } |
|
# $totaltries+=$returnhash{'resource.'.$part.'.tries'}; |
|
# } elsif ($returnhash{$_} eq 'correct_by_override') { |
|
# unless (($code eq '.') || ($code eq '-')) { $code='+'; } |
|
# } elsif ($returnhash{$_} eq 'incorrect_attempted') { |
|
# $code='.'; |
|
# } elsif ($returnhash{$_} eq 'incorrect_by_override') { |
|
# $code='-'; |
|
# } elsif ($returnhash{$_} eq 'excused') { |
|
# unless (($code eq '.') || ($code eq '-')) { $code='x'; } |
|
# } |
|
# } |
|
# } keys %returnhash; |
|
# if (($code eq '*') && ($totaltries<10)) { $code="$totaltries"; } |
|
# } |
|
# return $code; |
|
#} |
|
|
# ------------------------------------------------------------ Build page table |
# ------------------------------------------------------------ Build page table |
|
|
sub tracetable { |
sub tracetable { |
Line 165 sub handler {
|
Line 222 sub handler {
|
# ---------------------------------------------------------------- Course title |
# ---------------------------------------------------------------- Course title |
|
|
$r->print('<h1>'. |
$r->print('<h1>'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.'</h1>'); |
$ENV{'course.'.$ENV{'request.course.id'}.'.description'}.'</h1><h3>'. |
|
localtime()."</h3><p><pre>1..9: correct by student in 1..9 tries\n". |
|
" *: correct by student in more than 9 tries\n". |
|
" +: correct by override\n". |
|
" -: incorrect by override\n". |
|
" .: incorrect attempted\n". |
|
" : not attempted\n". |
|
" x: excused</pre><p>"); |
|
|
# ------------------------------- This is going to take a while, produce output |
# ------------------------------- This is going to take a while, produce output |
|
|
$r->rflush(); |
$r->rflush(); |
Line 218 sub handler {
|
Line 281 sub handler {
|
map { |
map { |
$i++; |
$i++; |
if ( $_ ne '') { |
if ( $_ ne '') { |
$rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' |
$rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' '; |
'; |
|
} |
} |
if ($i == 2) { |
if ($i == 2) { |
chop($rowlabels[$thisindex]); |
chop($rowlabels[$thisindex]); |
$rowlabels[$thisindex].=', '; |
$rowlabels[$thisindex].=', '; |
} |
} |
} split(/\&/,$reply); |
} split(/\&/,$reply); |
|
|
} |
} |
} |
} |
} sort split(/\&/,$classlst); |
} sort split(/\&/,$classlst); |
|
|
Line 248 sub handler {
|
Line 310 sub handler {
|
$r->print('<p><pre>'); |
$r->print('<p><pre>'); |
my $index; |
my $index; |
for ($index=0;$index<=$#students;$index++) { |
for ($index=0;$index<=$#students;$index++) { |
$r->print( |
# $r->print( |
substr($students[$index]. |
# substr($students[$index]. |
' ',0,14).' ! '. |
# ' ',0,14).' ! '. |
substr($rowlabels[$index]. |
# substr($rowlabels[$index]. |
' ',0,45).' ! '); |
# ' ',0,45).' ! '); |
map { |
# map { |
if ($_) { |
# if ($_) { |
$r->print(&astatus($_,$students[$index])); |
# $r->print(&astatus($_,$students[$index])); |
} else { |
# } else { |
$r->print(' ! '); |
# $r->print(' ! '); |
} |
# } |
} @cols; |
# } @cols; |
$r->print("\n"); |
# $r->print("\n"); |
|
$r->print(&ExtractStudentData($index,$cid).'<br>'); |
$r->rflush(); |
$r->rflush(); |
} |
} |
$r->print('</pre>'); |
$r->print('</pre>'); |