--- loncom/interface/lonstatistics.pm 2002/05/13 15:01:54 1.16 +++ loncom/interface/lonstatistics.pm 2002/05/13 16:41:46 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstatistics.pm,v 1.16 2002/05/13 15:01:54 minaeibi Exp $ +# $Id: lonstatistics.pm,v 1.17 2002/05/13 16:41:46 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,7 +83,6 @@ my %ConceptData; my %Header = (0,"Homework Sets Order",1,"#Stdnts",2,"Tries",3,"Mod", 4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"DoDiff", 9,"S.D.",10,"Skew.",11,"D.F.1st",12,"D.F.2nd"); -my %Answer = (); my @shown; sub InitAnalysis { @@ -101,7 +100,7 @@ sub InitAnalysis { # my $Answ=&Apache::lonnet::ssi($URI,('grade_target' => 'analyze')); (my $garbage,$Answ)=split(/_HASH_REF__/,$Answ,2); - %Answer=(); + my %Answer=(); %Answer=&Apache::lonnet::str2hash($Answ); my $parts=''; @@ -122,12 +121,11 @@ sub InitAnalysis { } chop($show); @shown=split(/\@/,$show); -# $r->print("
shown:".$show); -# $r->rflush(); - +# $r->print("
shown:".$show);# $r->rflush(); foreach my $concept (@{$Answer{"$parts.concepts"}}) { foreach my $foil (@{$Answer{"$parts.concept.$concept"}}) { $foil_to_concept{$foil} = $concept; + $ConceptData{$foil} = $Answer{"$parts.foil.value.$foil"}; } } return $symb; @@ -140,8 +138,7 @@ sub Interval { my $due = &Apache::lonnet::EXT('resource.$part.duedate',$symb)+1; my $opn = &Apache::lonnet::EXT('resource.$part.opendate',$symb); my $add=int(($due-$opn)/$Int); -#$r->print("
$opn, to $due add=$add int=$Int"); -#$r->rflush(); +#$r->print("
$opn, to $due add=$add int=$Int");#$r->rflush(); $ConceptData{"Int.0"}=$opn; for (my $i=1;$i<$Int;$i++) { $ConceptData{"Int.$i"}=$opn+$i*$add; @@ -199,15 +196,14 @@ ENDPOP } &Close_PrgWin(); -#$Apache::lonxml::debug=1; -#&Apache::lonhomework::showhash(%ConceptData); -#$Apache::lonxml::debug=0; - for (my $k=0; $k<$Int_No; $k++ ) { my $data1=''; my $data2=''; &DrawGraph(&AdjustData($k).'+'.$Src.'+'.($k+1)); } +#$Apache::lonxml::debug=1; +#&Apache::lonhomework::showhash(%ConceptData); +#$Apache::lonxml::debug=0; my $Answ=&Apache::lonnet::ssi($URI); $r->print("
Here you can see the Problem:
$Answ"); } @@ -223,6 +219,8 @@ sub AdjustData { $data2[$n]=$ConceptData{"$tmp.$k.false"}; my $Sum=$data1[$n]+$data2[$n]; if ( $Max<$Sum ) {$Max=$Sum;} + $ConceptData{"$tmp.true"}+=$data1[$n]; + $ConceptData{"$tmp.false"}+=$data2[$n]; } for (my $n=0; $n<=$#Concepts; $n++ ) { if ($data1[$n]+$data2[$n]<$Max) { @@ -253,7 +251,6 @@ sub DrawGraph { "\n"." ".localtime($ConceptData{'Int.'.$k}-1)." ". "\n".""; $r->print($Str); - # $r->print('
Correct Answers: '.$data1. # '
Wrong Answers: '.$data2); # $r->print('
From: '.localtime($ConceptData{'Int.'.($k-1)}). @@ -264,9 +261,8 @@ sub DrawGraph { # $Max = int($Max); # } # else { $Max = 1; } - my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.$k : $Src; - $GData=$Titr.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2; + $GData=$Titr.'&'.'Concepts'.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2; if($ConceptData{'Interval'}>1){ $r->print('
'); return; @@ -364,12 +360,12 @@ sub OpStatus { my $time=$reshash{"$version:timestamp"}; foreach (sort(split(/\:/,$reshash{$version.':keys'}))) { if (($_=~/\.(\w+)\.(\w+)\.submission$/)) { - my $Id1 = $1; - my $Id2 = $2; + #my $Id1=$1; my $Id2=$2; my $Resp = $reshash{$_}; my %submission=&Apache::lonnet::str2hash($Resp); foreach (keys %submission) { - my $Ansr = $Answer{"$Id1.$Id2.foil.value.$_"}; + my $Ansr = $ConceptData{"$_"}; + #my $Ansr = $Answer{"$Id1.$Id2.foil.value.$_"}; #$r->print("
shown: ".join(',',@shown)." size=$#shown"); if ($submission{$_}) { #if($#shown==-1){ @@ -1257,7 +1253,7 @@ sub TableRow { # ------------------------------------------- Prepare data for Graphical chart sub GetGraphData { - my $Tag = shift; + my $ylab = shift; my $Col; my $data=''; my $count = 0; @@ -1268,12 +1264,12 @@ sub GetGraphData { foreach (keys %GraphDat) {delete $GraphDat{$_};} if (-e "$GraphDB") { if (tie(%GraphDat,'GDBM_File',"$GraphDB",&GDBM_READER,0640)) { - if ( $Tag eq 'DoDiff Graph' ) { - $Tag = 'Degree-of-Difficulty'; + if ( $ylab eq 'DoDiff Graph' ) { + $ylab = 'Degree-of-Difficulty'; $Col = 0; } else { - $Tag = 'Wrong-Percentage'; + $ylab = 'Wrong-Percentage'; $Col = 1; } foreach (sort NumericSort keys %GraphDat) { @@ -1291,7 +1287,7 @@ sub GetGraphData { untie(%GraphDat); my $Course = $ENV{'course.'.$cid.'.description'}; $Course =~ s/\ /"_"/eg; - $GData=$Course.'&'.$Tag.'&'.$Max.'&'.$count.'&'.$data; + $GData=$Course.'&'.'Problems'.'&'.$ylab.'&'.$Max.'&'.$count.'&'.$data; } else { $r->print("Unable to tie hash to db file"); @@ -1459,9 +1455,6 @@ sub Menu { if ($InpStr=~/^Analyze\_/) { &ShowOpGraph($InpStr,$ENV{'form.interval'}); } - #elsif ($InpStr=~/^View\_/) { -# &ShowStG(); - # } elsif ( $InpStr eq 'DoDiff Graph' || $InpStr eq '%Wrong Graph' ) { &GetGraphData($InpStr); $r->print('');