--- loncom/interface/lonstatistics.pm 2002/05/16 01:27:05 1.19 +++ loncom/interface/lonstatistics.pm 2002/05/19 15:44:40 1.20 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstatistics.pm,v 1.19 2002/05/16 01:27:05 minaeibi Exp $ +# $Id: lonstatistics.pm,v 1.20 2002/05/19 15:44:40 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +31,7 @@ # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei # YEAR=2002 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei -# 5/12, 5/14, 5/15 Behrouz Minaei +# 5/12,5/14,5/15,5/19 Behrouz Minaei # ### @@ -174,6 +174,9 @@ sub ShowOpGraph { for (my $k=0; $k<$Int_No; $k++ ) { &DrawGraph($k,$Src); } + for (my $k=0; $k<$Int_No; $k++ ) { + &DrawTable($k); + } #$Apache::lonxml::debug=1; #&Apache::lonhomework::showhash(%ConceptData); #$Apache::lonxml::debug=0; @@ -182,14 +185,13 @@ sub ShowOpGraph { } -sub DrawGraph { - my ($k,$Src)=@_; +sub DrawTable { + my $k=shift; my $Max=0; my @data1; my @data2; my $Correct=0; my $Wrong=0; - # Adjust Data and find the Max for (my $n=0; $n<=$#Concepts; $n++ ) { my $tmp=$Concepts[$n]; $data1[$n]=$ConceptData{"$tmp.$k.true"}; @@ -223,17 +225,39 @@ sub DrawGraph { "\n"." ".$data2[$n]." ". "\n".""; } + $Str.='From:['.localtime($ConceptData{'Int.'.$k}). + '] To: ['.localtime($ConceptData{'Int.'.($k+1)}-1). + "]$Correct$Wrong"; + + $Str .= "\n".''; + + $r->print($Str); #$Apache::lonxml::debug=1; #&Apache::lonhomework::showhash(%ConceptData); #$Apache::lonxml::debug=0; +} -# $Str.='From:['.localtime($ConceptData{'Int.$k'}). -# '] To: ['.localtime($ConceptData{'Int.'.($k+1)}). -# "]$Correct$Wrong";# - $Str .= "\n".''; +sub DrawGraph { + my ($k,$Src)=@_; + my $Max=0; + my @data1; + my @data2; -# $r->print($Str); + # Adjust Data and find the Max + for (my $n=0; $n<=$#Concepts; $n++ ) { + my $tmp=$Concepts[$n]; + $data1[$n]=$ConceptData{"$tmp.$k.true"}; + $data2[$n]=$ConceptData{"$tmp.$k.false"}; + my $Sum=$data1[$n]+$data2[$n]; + if ( $Max<$Sum ) {$Max=$Sum;} + } + for (my $n=0; $n<=$#Concepts; $n++ ) { + if ($data1[$n]+$data2[$n]<$Max) { + $data2[$n]+=$Max-($data1[$n]+$data2[$n]); + } + } + my $P_No = $#data1+1; if ( $Max > 1 ) { $Max += (10 - $Max % 10); @@ -547,7 +571,7 @@ sub StudentReport { sub CreateTable { my ($Hd, $Hid)=@_; - if ($ENV{'form.showcsv'}) { + if ($ENV{'form.showcsv'}) { if ( $Hd == 1 ) { $r->print('
"'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"'); } @@ -1144,9 +1168,8 @@ sub Cache_Statistics { my @list = (); my $Useful; my $UnUseful; +# $r->print(''."\n"); my %myHeader = reverse( %Header ); - #&Apache::lonnet::delenv('form_'); - #&Apache::lonnet::delenv('test'); $Pos = $myHeader{$ENV{'form.sort'}}; if ($Pos > 0) {$Pos++;} $p_count = 0; @@ -1347,7 +1370,10 @@ sub ClassList { # my ($temp)=keys(%students); # unless ($temp=~/^error\:/) { # foreach my $KeyPoint(sort keys(%students)) { + + my $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome); + my $StudNo = 0; my $now=time; unless ($classlst=~/^error\:/) { @@ -1408,74 +1434,6 @@ sub ClassList { } -sub ClassListnew { - - &GetStatus(); - - $cid=$ENV{'request.course.id'}; - my $chome=$ENV{'course.'.$cid.'.home'}; - my ($cdom,$cnum)=split(/\_/,$cid); -# ----------------------- Get first and last resource, see if there is anything - $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}}; - $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}}; - if (($firstres) && ($lastres)) { - - my %students = &Apache::lonnet::dump('classlist',$cdom,$cnum); - my $StudNo = 0; - my $now=time; - my ($temp)=keys(%students); - unless ($temp=~/^error\:/) { - foreach (sort keys(%students)) { - my ($name,$value)=split(/\=/,$_); - my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value)); - $name=&Apache::lonnet::unescape($name); - my ($sname,$sdom)=split(/\:/,$name); - my $active=1; - my $Status=$ENV{'form.status'}; - $Status = ($Status) ? $Status : 'Active'; - if ( ( ($end) && $now > $end ) && - ( ($Status eq 'Active') ) ) { $active=0; } - if ( ($Status eq 'Expired') && - ($end == 0 || $now < $end) ) { $active=0; } - if ($active) { - my $thisindex=$#students+1; - $name=&Apache::lonnet::unescape($name); - $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;} - if ($ssec==-1 || $ssec eq 'adm' ) {next;} - $ssec=($ssec) ? $ssec : '(none)'; - #$ssec=(int($ssec)) ? int($ssec) : $ssec; - $section{$ssec}=$ssec; - if ($CurSec eq 'All Sections' || $ssec eq $CurSec) { - $students[$StudNo]=$name; - $StuBox{$sname}=$sdom; - } - $StudNo++; - } - } - } - else { - $r->print('

Could not access course data

'); - } - $r->print("Total number of students : ".($#students+1)); - $r->rflush(); -# --------------- Find all assessments and put them into some linear-like order - &tracetable($firstres,'&'.$lastres.'&'); - } - -# ------------------------------------------------------------- End render page - else { - $r->print('

Undefined course sequence

'); - } -} - - sub Title { $r->print('LON-CAPA Statistics'); $r->print(''. @@ -1493,8 +1451,8 @@ sub Title { sub CreateForm { $r->print("\n".'
'); my $content = $ENV{'form.sort'}; - if (!($ENV{'form.showcsv'}) && #|| !($ENV{'csv'})) && - ($content eq '' || $content eq 'Return to Menu')) { + if (!($ENV{'form.showcsv'}) && + ($content eq '' || $content eq 'Return to Menu')) { my $Ptr = '

'; $Ptr .= ''; $Ptr .= '

';