[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm
minaeibi
lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 16:41:46 -0000
minaeibi Mon May 13 12:41:46 2002 EDT
Modified files:
/loncom/interface lonstatistics.pm
Log:
Fixed bugs in loading the graph of DoDiff and %wrong
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.16 loncom/interface/lonstatistics.pm:1.17
--- loncom/interface/lonstatistics.pm:1.16 Mon May 13 11:01:54 2002
+++ loncom/interface/lonstatistics.pm Mon May 13 12:41:46 2002
@@ -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 %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 @@
# 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 @@
}
chop($show);
@shown=split(/\@/,$show);
-# $r->print("<br> shown:".$show);
-# $r->rflush();
-
+# $r->print("<br> 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 @@
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("<br> $opn, to $due add=$add int=$Int");
-#$r->rflush();
+#$r->print("<br> $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 @@
}
&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("<br><b>Here you can see the Problem:</b><br>$Answ");
}
@@ -223,6 +219,8 @@
$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 @@
"\n"."<td> ".localtime($ConceptData{'Int.'.$k}-1)." </td>".
"\n"."</tr></table>";
$r->print($Str);
-
# $r->print('<br><b>Correct Answers:</b> '.$data1.
# '<br><b>Wrong Answers: </b>'.$data2);
# $r->print('<br><b>From: </b>'.localtime($ConceptData{'Int.'.($k-1)}).
@@ -264,9 +261,8 @@
# $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('<br><IMG src="/cgi-bin/graph.gif?'.$GData.'" />');
return;
@@ -364,12 +360,12 @@
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("<br>shown: ".join(',',@shown)." size=$#shown");
if ($submission{$_}) {
#if($#shown==-1){
@@ -1257,7 +1253,7 @@
# ------------------------------------------- Prepare data for Graphical chart
sub GetGraphData {
- my $Tag = shift;
+ my $ylab = shift;
my $Col;
my $data='';
my $count = 0;
@@ -1268,12 +1264,12 @@
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 @@
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 @@
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('<IMG src="/cgi-bin/graph.gif?'.$GData.'" />');