version 1.5, 2002/03/02 01:42:42
|
version 1.6, 2002/03/02 23:22:32
|
Line 30
|
Line 30
|
# 5/05,7/09,7/25/01,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei |
# 5/05,7/09,7/25/01,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei |
# 11/1, 11/4, 11/16, 12/14, 12/16, 12/18,12/20,12/31 Behrouz Minaei |
# 11/1, 11/4, 11/16, 12/14, 12/16, 12/18,12/20,12/31 Behrouz Minaei |
# YEAR=2002 |
# YEAR=2002 |
# 1/22, 2/1, 2/6, 2/25 Behrouz Minaei |
# 1/22, 2/1, 2/6, 2/25, 3/2 Behrouz Minaei |
### |
### |
|
|
package Apache::lonstatistics; |
package Apache::lonstatistics; |
Line 75 my $lastres;
|
Line 75 my $lastres;
|
my $DiscFlag; |
my $DiscFlag; |
my $HWN; |
my $HWN; |
my $P_Order; |
my $P_Order; |
my %Header = (0,"Homework Problems",1,"#Stdnts",2,"Tries",3,"Mod", |
my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", |
4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", |
4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", |
9,"S.D.",10,"Skew.",11,"Map"); |
9,"S.D.",10,"Skew.",11,"Map"); |
# 11,"Dis.F.",12,"Resourse URL"); |
# 11,"Dis.F.",12,"Resourse URL"); |
Line 244 sub PreStatTable {
|
Line 244 sub PreStatTable {
|
"_$ENV{'user.domain'}_$cid\_graph.db"; |
"_$ENV{'user.domain'}_$cid\_graph.db"; |
my $CachDisFac = "/home/httpd/perl/tmp/$ENV{'user.name'}". |
my $CachDisFac = "/home/httpd/perl/tmp/$ENV{'user.name'}". |
"_$ENV{'user.domain'}_$cid\_DiscFactor.db"; |
"_$ENV{'user.domain'}_$cid\_DiscFactor.db"; |
$r->print('<br><input type="submit" name="sort" value="Recalculate Statistics" />'); |
my $OpSel11=''; |
|
my $OpSel12=''; |
|
my $OpSel13=''; |
|
my $Status = $ENV{'form.status'}; |
|
if ( $Status eq 'Any' ) { $OpSel13='selected'; } |
|
elsif ($Status eq 'Expired' ) { $OpSel12 = 'selected'; } |
|
else { $OpSel11 = 'selected'; } |
|
|
my $Ptr = ''; |
my $Ptr = ''; |
|
$Ptr .= '<br><b> Student Status: </b>'."\n". |
|
'<select name="status">'. |
|
'<option '.$OpSel11.' >Active</option>'."\n". |
|
'<option '.$OpSel12.' >Expired</option>'."\n". |
|
'<option '.$OpSel13.' >Any</option> </select> '."\n"; |
|
$Ptr .= ' '; |
|
$Ptr .= '<input type=submit name=sort value="Recalculate Statistics"/>'."\n"; |
|
|
$Ptr .= '<br><b> Sorting Type: </b>'."\n". |
$Ptr .= '<br><b> Sorting Type: </b>'."\n". |
'<select name="order"> <option '.$OpSel1.' >Ascending</option>'."\n". |
'<select name="order"> <option '.$OpSel1.' >Ascending</option>'."\n". |
Line 312 sub PreStatTable {
|
Line 325 sub PreStatTable {
|
# ------------------------------------- Find the section of student in a course |
# ------------------------------------- Find the section of student in a course |
|
|
sub usection { |
sub usection { |
my ($udom,$unam,$courseid)=@_; |
my ($udom,$unam,$courseid,$ActiveFlag)=@_; |
$courseid=~s/\_/\//g; |
$courseid=~s/\_/\//g; |
$courseid=~s/^(\w)/\/$1/; |
$courseid=~s/^(\w)/\/$1/; |
map { |
foreach (split(/\&/,&Apache::lonnet::reply('dump:'. |
|
$udom.':'.$unam.':roles', |
|
&Apache::lonnet::homeserver($unam,$udom)))){ |
my ($key,$value)=split(/\=/,$_); |
my ($key,$value)=split(/\=/,$_); |
$key=&Apache::lonnet::unescape($key); |
$key=&Apache::lonnet::unescape($key); |
if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) { |
if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) { |
my $section=$1; |
my $section=$1; |
if ($key eq $courseid.'_st') { $section=''; } |
if ($key eq $courseid.'_st') { $section=''; } |
my ($dummy,$end,$start)=split(/\_/,&Apache::lonnet::unescape($value)); |
my ($dummy,$end,$start)=split(/\_/,&Apache::lonnet::unescape($value)); |
$section=($section) ? $section : '(none)'; |
if ( $ActiveFlag ne 'Any' ) { |
# $section=(int($section)) ? int($section) : $section; |
my $now=time; |
# $r->print($unam.'...'.$section.'<br>'); |
my $notactive=0; |
|
if ($start) { |
|
if ($now<$start) { $notactive=1; } |
|
} |
|
if ($end) { |
|
if ($now>$end) { $notactive=1; } |
|
} |
|
if ((($ActiveFlag eq 'Expired') && $notactive == 1) || |
|
(($ActiveFlag eq 'Active') && $notactive == 0 ) ) { |
|
return $section; |
|
} |
|
else { return '-1'; } |
|
} |
return $section; |
return $section; |
} |
} |
} split(/\&/,&Apache::lonnet::reply('dump:'.$udom.':'.$unam.':roles', |
} |
&Apache::lonnet::homeserver($unam,$udom))); |
return '-1'; |
return ''; |
|
} |
} |
|
|
|
|
Line 553 sub tracetable {
|
Line 579 sub tracetable {
|
} |
} |
|
|
sub MySort { |
sub MySort { |
if ( $Pos > 0 && $Pos < 11 ) { |
if ( $Pos > 0 ) { |
if ($ENV{'form.order'} eq 'Descending') {$b <=> $a;} |
if ($ENV{'form.order'} eq 'Descending') {$b <=> $a;} |
else { $a <=> $b; } |
else { $a <=> $b; } |
} |
} |
Line 567 sub Build_Statistics {
|
Line 593 sub Build_Statistics {
|
$r->print(<<ENDPOP); |
$r->print(<<ENDPOP); |
<script> |
<script> |
popwin=open('','popwin','width=400,height=100'); |
popwin=open('','popwin','width=400,height=100'); |
popwin.document.writeln('<html><body bgcolor="#7777EE">'+ |
popwin.document.writeln('<html><body bgcolor="#88CC88">'+ |
'<title>LON-CAPA Statistics</title>'+ |
'<title>LON-CAPA Statistics</title>'+ |
'<h4>Computation Progress</h4>'+ |
'<h4>Computation Progress</h4>'+ |
'<form name=popremain>'+ |
'<form name=popremain>'+ |
Line 701 ENDPOP
|
Line 727 ENDPOP
|
my $join = $PrOrd.':'.$Temp.':'.$StdNo.':'. |
my $join = $PrOrd.':'.$Temp.':'.$StdNo.':'. |
$TotalTries.':'.$MxTries.':'.$Avg.':'. |
$TotalTries.':'.$MxTries.':'.$Avg.':'. |
$YES.':'.$Override.':'.$Wrng.':'.$DoD.':'. |
$YES.':'.$Override.':'.$Wrng.':'.$DoD.':'. |
$SD.':'.$Sk.':'.$Map.':'.$Prob; |
$SD.':'.$Sk.':'.$Prob; |
$CachData{($p_count-1)}=$join; |
$CachData{($p_count-1)}=$join; |
|
|
$urlres=~/^(\w+)\/(\w+)/; |
$urlres=~/^(\w+)\/(\w+)/; |
Line 727 sub Cache_Statistics {
|
Line 753 sub Cache_Statistics {
|
$p_count = 0; |
$p_count = 0; |
foreach my $key( keys %CachData) { |
foreach my $key( keys %CachData) { |
my @Temp=split(/\:/,$CachData{$key}); |
my @Temp=split(/\:/,$CachData{$key}); |
if ( $Pos == 0 || $Pos == 11 ) { |
if ( $Pos == 0 ) { |
($UnUseful,$Useful)=split(/\>/,$Temp[$Pos]); |
($UnUseful,$Useful)=split(/\>/,$Temp[$Pos]); |
} |
} |
else { |
else { |
Line 767 sub Cache_Statistics {
|
Line 793 sub Cache_Statistics {
|
sub TableRow { |
sub TableRow { |
my ($Str,$Idx,$RealIdx)=@_; |
my ($Str,$Idx,$RealIdx)=@_; |
my($PrOrd,$Temp,$StdNo,$TotalTries,$MxTries,$Avg,$YES, |
my($PrOrd,$Temp,$StdNo,$TotalTries,$MxTries,$Avg,$YES, |
$Override,$Wrng,$DoD,$SD,$Sk,$res,$Prob)=split(/\:/,$Str); |
$Override,$Wrng,$DoD,$SD,$Sk,$Prob)=split(/\:/,$Str); |
$r->print( "\n".'<tr>'. |
$r->print( "\n".'<tr>'. |
"\n".'<td>'.($RealIdx+1).'</td>'. |
"\n".'<td>'.($RealIdx+1).'</td>'. |
"\n".'<td bgcolor="#FFFFFF">'.$Temp.'</td>'. |
"\n".'<td bgcolor="#FFFFFF">'.$Temp.'</td>'. |
Line 866 sub ClassList {
|
Line 892 sub ClassList {
|
my $classlst=&Apache::lonnet::reply |
my $classlst=&Apache::lonnet::reply |
('dump:'.$cdom.':'.$cnum.':classlist',$chome); |
('dump:'.$cdom.':'.$cnum.':classlist',$chome); |
my $StudNo = 0; |
my $StudNo = 0; |
|
my $now=time; |
unless ($classlst=~/^error\:/) { |
unless ($classlst=~/^error\:/) { |
foreach (sort split(/\&/,$classlst)) { |
foreach (sort split(/\&/,$classlst)) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value)); |
my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value)); |
$name=&Apache::lonnet::unescape($name); |
$name=&Apache::lonnet::unescape($name); |
my ($sname,$sdom)=split(/\:/,$name); |
my ($sname,$sdom)=split(/\:/,$name); |
my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid); |
my $active=1; |
if ($ssec==-1) {next;} |
my $Status=$ENV{'form.status'}; |
$ssec=($ssec) ? $ssec : '(none)'; |
$Status = ($Status) ? $Status : 'Active'; |
#$ssec=(int($ssec)) ? int($ssec) : $ssec; |
if ( ( ($end) && $now > $end ) && |
#$r->print($sname.'...'.$ssec.'<br>'); |
( ($Status eq 'Active') ) ) { $active=0; } |
$section{$ssec}=$ssec; |
if ( ($Status eq 'Expired') && |
if ($CurSec eq 'All Sections' || $ssec eq $CurSec) { |
($end == 0 || $now < $end) ) { $active=0; } |
$students[$StudNo]=$name; |
if ($active) { |
$StuBox{$sname}=$ssec; |
my $thisindex=$#students+1; |
} |
$name=&Apache::lonnet::unescape($name); |
$StudNo++; |
$students[$thisindex]=$name; |
|
my ($sname,$sdom)=split(/\:/,$name); |
|
|
|
#my %reply=&Apache::lonnet::idrget($sdom,$sname); |
|
#my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname. |
|
# ':environment:lastname&generation&firstname&middlename', |
|
# &Apache::lonnet::homeserver($sname,$sdom)); |
|
my $ssec=&usection($sdom,$sname,$cid,$Status); |
|
if ($ssec==-1) {next;} |
|
$ssec=($ssec) ? $ssec : '(none)'; |
|
#$ssec=(int($ssec)) ? int($ssec) : $ssec; |
|
#$r->print($sname.'...'.$ssec.'<br>'); |
|
$section{$ssec}=$ssec; |
|
if ($CurSec eq 'All Sections' || $ssec eq $CurSec) { |
|
$students[$StudNo]=$name; |
|
$StuBox{$sname}=$ssec; |
|
} |
|
$StudNo++; |
|
} |
} |
} |
} |
} |
else { |
else { |