--- loncom/interface/lonstatistics.pm 2002/03/22 23:06:30 1.13 +++ loncom/interface/lonstatistics.pm 2002/03/26 18:11:32 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstatistics.pm,v 1.13 2002/03/22 23:06:30 minaeibi Exp $ +# $Id: lonstatistics.pm,v 1.14 2002/03/26 18:11:32 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,9 +28,10 @@ # (Navigate problems for statistical reports # YEAR=2001 # 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 -# 1/22, 2/1, 2/6, 2/25, 3/2, 3/6, 3/17, 3/21, 3/22 Behrouz Minaei +# 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26 Behrouz Minaei +# ### package Apache::lonstatistics; @@ -158,17 +159,13 @@ sub NumericSort { # ------ Create different Student Report sub StudentReport { - my ($sname,$sdom)=@_; - if ( $sname eq 'All Students' ) { $r->print( '

WARNING: Please select a student

' ); return; } - my $shome=&Apache::lonnet::homeserver($sname,$sdom); - my $reply=&Apache::lonnet::reply('dump:'.$sdom.':'.$sname.':'.$cid,$shome ); - my %result = (); + my %result = &Apache::lonnet::dump($cid,$sdom,$sname); my $ResId; my $PrOrd; my $Code; @@ -189,11 +186,8 @@ sub StudentReport { "\n".' Results '. "\n".' Tries '. "\n".''; - unless ($reply=~/^error\:/) { - foreach (split(/\&/,$reply)){ - my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_)); - $result{$name}=$value; - } + my ($temp)=keys(%result); + unless ($temp=~/^error\:/) { foreach my $CurCol (@cols) { if (!$CurCol){ my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1}); @@ -231,7 +225,6 @@ sub StudentReport { $PartNo++; } } - #if ($_=~/^parameter\_(\w+)\_package$/) { } my $Prob = $Map.'___'.$2.'___'. @@ -362,10 +355,10 @@ sub PreStatTable { 'evaluating the problem according to a Criterion
'. ' [Applied Criterion in %27 Upper Students - '. 'Applied the same Criterion in %27 Lower Students]
'. - ' 1st Criterion for Sorting the Students: '. - 'Sum of Partial Credit Awarded / Total Number of Tries
'. - ' 2nd Criterion for Sorting the Students: '. - 'Total number of Correct Answers / Total Number of Tries'. + ' 1st Criterion for Sorting the Students: '. + 'Sum of Partial Credit Awarded / Total Number of Tries
'. + ' 2nd Criterion for Sorting the Students: '. + 'Total number of Correct Answers / Total Number of Tries'. ''; $r->print($Ptr); @@ -456,11 +449,9 @@ sub usection { # ------ Dump the Student's DB file and handling the data for statistics table sub ExtractStudentData { - my ($student,$coid)=@_; + my $student=shift; my ($sname,$sdom) = split( /\:/, $student ); - my $shome=&Apache::lonnet::homeserver( $sname,$sdom ); - my $reply=&Apache::lonnet::reply('dump:'.$sdom.':'.$sname.':'.$coid,$shome ); - my %result = (); + my %result = &Apache::lonnet::dump($cid,$sdom,$sname); my $ResId; my $PrOrd; my $Dis = ''; @@ -479,11 +470,8 @@ sub ExtractStudentData { my $LatestVersion; my $SecLimit; my $MapLimit; - unless ($reply=~/^error\:/) { - foreach (split(/\&/,$reply)) { - my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_)); - $result{$name}=$value; - } + my ($temp)=keys(%result); + unless ($temp=~/^error\:/) { foreach my $CurCol(@cols) { ($PrOrd,$ResId)=split(/\:/,$CurCol); if ( !$CurCol ) { next; } @@ -510,13 +498,12 @@ sub ExtractStudentData { $TempHash{"$Part.PrOrd"} = $PrOrd+$PartNo; $PartNo++; } - my $Part=&Apache::lonnet::metadata($meta,$_.'.part'); + #my $Part=&Apache::lonnet::metadata($meta,$_.'.part'); } } my $Prob = $Map.'___'.$PrbId.'___'. &Apache::lonnet::declutter( $hash{'src_'.$ResId} ); - $OpResp{$PrOrd}=$Prob; $Code='U'; $Tries = 0; $ParCr = 0; @@ -524,16 +511,26 @@ sub ExtractStudentData { $LatestVersion = $result{"version:$Prob"}; if ( $LatestVersion ) { -#333333333 -#my $userview=&Apache::lonnet::ssi($hash{'src_'.$ResId}); -#$r->print('
'.$userview); -#$r->print('
'.$Prob.$sname.$sdom.$coid.'
'.&get_student_answers($Prob,$sname,$sdom,$coid)); - for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) { my $vkeys = $result{"$Version:keys:$Prob"}; my @keys = split(/\:/,$vkeys); - + foreach my $Key (@keys) { +#333333333 +# if ($OpResp{$PrOrd}) { +# if (($Key=~/\.(\w+)\.submission$/)) { +# my $Resp = $result{"$Version:$Prob:$Key"}; +# $r->print('
'.$Prob.'
'.$sname.'
'.$PrOrd.'
'.$Key.'
'.$Resp.''); +# $r->rflush(); +# +# my %submission=&Apache::lonnet::str2hash($Resp); +# my $cb=0; +# foreach (sort keys %submission) { +# $r->print('
'.$cb.')'.$_.' ... '.$submission{$_}); +# $cb++; +# } +# } +# } if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) { my $Part = $1; $Tries = $result{"$Version:$Prob:resource.$Part.tries"}; @@ -644,25 +641,26 @@ sub tracetable { my $meta=$hash{'src_'.$frid}; my $PartNo = 0; + my $Part; # if ($IsMap==0){ if ($meta) { if ($meta=~/\.(problem|exam|quiz|assess|survey|form)$/) { foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) { if ($_=~/^stores\_(\w+)\_tries$/) { - &Apache::lonnet::metadata($meta,$_.'.part'); + $Part=&Apache::lonnet::metadata($meta,$_.'.part'); $P_Order++; $mapsort{$HWN} .= '&'.$P_Order; $PartNo++; #$r->print('
'.$PartNo.'---'.$P_Order); } + foreach my $K(split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) { + if ($K=~/^optionresponse\_($Part)\_(\w+)$/) { + #$r->print('
'.$_.'...'.$P_Order.'---'.$Part); + $OpResp{$P_Order+1}=$frid; + } + + } } -# foreach (split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) { -# if ($_=~/^optionresponse\_(\w+)\_(\w+)$/) { -# $r->print('
'.$_.&Apache::lonnet::metadata($meta,$_)); -# $r->print('
'.$_.'...'.$P_Order); -# $OpResp{$P_Order+1}=$frid; -# } -# } } } } @@ -735,7 +733,7 @@ ENDPOP $students[$index].'";'); $r->rflush(); - &ExtractStudentData($students[$index],$cid); + &ExtractStudentData($students[$index]); } # -------------------- sorting the Data