Diff for /loncom/interface/lonstatistics.pm between versions 1.16 and 1.17

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

Removed from v.1.16  
changed lines
  Added in v.1.17


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>