version 1.2, 2001/01/31 23:28:06
|
version 1.9, 2001/10/22 14:52:14
|
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 |
|
# 10/18/01, 10/19/01 Behrouz Minaei |
|
|
package Apache::lonchart; |
package Apache::lonchart; |
|
|
Line 31 my @students;
|
Line 35 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 %TempHash; |
&Apache::lonnet::homeserver($uname,$udom)); |
my $Version; |
my %returnhash=(); |
my $LatestVersion; |
map { |
|
my ($name,$value)=split(/\=/,$_); |
my $Str=substr($students[$index]. |
$returnhash{&Apache::lonnet::unescape($name)}= |
' ',0,14).' ! '. |
&Apache::lonnet::unescape($value); |
substr($rowlabels[$index]. |
} split(/\&/,$answer); |
' ',0,45).' ! '; |
if ($returnhash{'version'}) { |
|
my $version; |
unless ($reply=~/^error\:/) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
map { |
map { |
my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_)); |
$returnhash{$_}=$returnhash{$version.':'.$_}; |
$result{$name}=$value; |
} split(/\:/,$returnhash{$version.':keys'}); |
} split(/\&/,$reply); |
} |
foreach $ResId (@cols) { |
my $totaltries=0; |
if ( !$ResId ) { $Str .= ' ! '; next; } |
map { |
$ResId=~/(\d+)\.(\d+)/; |
if (($_=~/\.(\w+)\.solved$/) && ($_!~/^\d+\:/)) { |
my $Prob = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ). |
my $part=$1; |
'___'.$2.'___'. |
if ($returnhash{$_} eq 'correct_by_student') { |
&Apache::lonnet::declutter( $hash{'src_'.$ResId} ); |
unless (($code eq '.') || ($code eq '-')) { $code='*'; } |
$Code=' '; |
$totaltries+=$returnhash{'resource.'.$part.'.tries'}; |
$Tries = 0; |
} elsif ($returnhash{$_} eq 'correct_by_override') { |
$LatestVersion = $result{"version:$Prob"}; |
unless (($code eq '.') || ($code eq '-')) { $code='+'; } |
|
} elsif ($returnhash{$_} eq 'incorrect_attempted') { |
undef %TempHash; |
$code='.'; |
my $PartNo = 0; |
} elsif ($returnhash{$_} eq 'incorrect_by_override') { |
|
$code='-'; |
if ( $LatestVersion ) { |
} elsif ($returnhash{$_} eq 'excused') { |
|
unless (($code eq '.') || ($code eq '-')) { $code='x'; } |
for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) { |
} |
my $vkeys = $result{"$Version:keys:$Prob"}; |
} |
my @keys = split(/\:/,$vkeys); |
} keys %returnhash; |
foreach my $Key (@keys) { |
if (($code eq '*') && ($totaltries<10)) { $code="$totaltries"; } |
if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) { |
|
my $Part = $1; |
|
if ( $TempHash{"$Part"} eq '' ) { |
|
$TempHash{"$Part"} = $Part; |
|
$TempHash{$PartNo}=$Part; |
|
$TempHash{"$Part.Code"} = ' '; |
|
$PartNo++; |
|
} |
|
$TempHash{"$Part.Tries"} = $result{"$Version:$Prob:resource.$Part.tries"}; |
|
$Tries = $result{"$Version:$Prob:resource.$Part.tries"}; |
|
my $Val = $result{"$Version:$Prob:$Key"}; |
|
if ($Val eq 'correct_by_student'){$Code='*';} |
|
elsif ($Val eq 'correct_by_override'){$Code = '+';} |
|
elsif ($Val eq 'incorrect_attempted'){$Code = '.';} |
|
elsif ($Val eq 'incorrect_by_override'){$Code = '-';} |
|
elsif ($Val eq 'excused'){$Code = 'x';} |
|
$TempHash{"$Part.Code"} = $Code; |
|
} |
|
} |
|
} |
|
|
|
for ( my $n = 0; $n < $PartNo; $n++ ) { |
|
my $part = $TempHash{$n}; |
|
if (($TempHash{$part.'.Code'} eq '*')&& |
|
($TempHash{$part.'.Tries'}<10)) { |
|
$TempHash{$part.'.Code'}=$Tries; |
|
} |
|
$Str .= $TempHash{$part.'.Code'}; |
|
} |
|
} |
|
else { $Str .= ' '; } |
|
} |
} |
} |
return $code; |
return $Str; |
} |
} |
|
|
|
|
# ------------------------------------------------------------ Build page table |
# ------------------------------------------------------------ Build page table |
|
|
sub tracetable { |
sub tracetable { |
my ($rid,$beenhere)=@_; |
my ($rid,$beenhere)=@_; |
unless ($beenhere=~/\&$rid\&/) { |
unless ($beenhere=~/\&$rid\&/) { |
$beenhere.=$rid.'&'; |
$beenhere.=$rid.'&'; |
|
# new ... updating the map according to sequence and page |
if (defined($hash{'is_map_'.$rid})) { |
if (defined($hash{'is_map_'.$rid})) { |
if ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}} |
my $cmap=$hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}; |
eq 'sequence') { |
if ( $cmap eq 'sequence' || $cmap eq 'page' ) { |
$cols[$#cols+1]=0; |
$cols[$#cols+1]=0; |
} |
} |
if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) && |
if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) && |
Line 165 sub handler {
|
Line 202 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 209 sub handler {
|
Line 252 sub handler {
|
'Data not available: '.$name; |
'Data not available: '.$name; |
} else { |
} else { |
my %reply=&Apache::lonnet::idrget($sdom,$sname); |
my %reply=&Apache::lonnet::idrget($sdom,$sname); |
my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname. |
my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname. |
':environment:firstname&middlename&lastname&generation', |
':environment:lastname&generation&firstname&middlename', |
&Apache::lonnet::homeserver($sname,$sdom)); |
&Apache::lonnet::homeserver($sname,$sdom)); |
$rowlabels[$thisindex]= |
$rowlabels[$thisindex]= |
$ssec.' '.$reply{$sname}.' '; |
sprintf('%3s',$ssec).' '.$reply{$sname}.' '; |
|
my $i=0; |
map { |
map { |
$rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' '; |
$i++; |
|
if ( $_ ne '') { |
|
$rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' '; |
|
} |
|
if ($i == 2) { |
|
chop($rowlabels[$thisindex]); |
|
$rowlabels[$thisindex].=', '; |
|
} |
} split(/\&/,$reply); |
} split(/\&/,$reply); |
|
|
} |
} |
} |
} |
} sort split(/\&/,$classlst); |
} sort split(/\&/,$classlst); |
Line 238 sub handler {
|
Line 290 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(&ExtractStudentData($index,$cid).'<br>'); |
substr($students[$index]. |
|
' ',0,14).' ! '. |
|
substr($rowlabels[$index]. |
|
' ',0,45).' ! '); |
|
map { |
|
if ($_) { |
|
$r->print(&astatus($_,$students[$index])); |
|
} else { |
|
$r->print(' ! '); |
|
} |
|
} @cols; |
|
$r->print("\n"); |
|
$r->rflush(); |
$r->rflush(); |
} |
} |
$r->print('</pre>'); |
$r->print('</pre>'); |