+
+ function display(name) {
+ document.forms.displayform.elements.dis.value=name;
+ window.status=name;
+ }
+ function cleardisplay() {
+ document.forms.displayform.elements.dis.value='';
+ window.status='No Concept in particular';
+ }
+
+
+ENDPOP
+
+ &Create_PrgWin();
+ &Update_PrgWin("Starting to analyze problem");
+ my $rid=substr($InpStr,8);
+ $ConceptData{"Interval"}=$Int_No;
+ &Interval(&InitAnalysis($rid,$students[0]));
+ my $URI = $hash{'src_'.$rid};
+ my $Src = $hash{'title_'.$rid};
+ $Src =~ s/\ /"_"/eg;
+ $r->print('
'.$URI.'');
+ for (my $n=1; $n<=$#Concepts+1; $n++ ) {
+ my $tmp=$Concepts[$n-1];
+ $tmp =~ s/" less than "/eg;
+ $r->print("
Concept $n:$tmp");
+ }
+
+ $r->rflush();
+
+ for (my $index=0;$index<=$#students;$index++) {
+ &Update_PrgWin($index);
+ &OpStatus($rid,$students[$index]);
+ }
+ &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));
+ }
+ my $Answ=&Apache::lonnet::ssi($URI);
+ $r->print("
Here you can see the Problem:
$Answ");
+}
+
+sub AdjustData {
+ my $k=shift;
+ my $Max=0;
+ my @data1;
+ my @data2;
+ 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]);
+ }
+ }
+ return join(',',@data1).'+'.
+ join(',',@data2).'+'.
+ $Max.'+'.($#data1+1);
+}
+
+
+sub DrawGraph {
+ my $data=shift;
+ my($data1,$data2,$Max,$P_No,$Src,$k)=split(/\+/,$data);
+
+ my $Str="\n".''.
+ "\n".''.
+ "\n".' Correct Answers | '.
+ "\n".' Wrong Answers | '.
+ "\n".' From | '.
+ "\n".' To | '.
+ "\n".'
'.
+ "\n"."".
+ "\n"." $data1 | ".
+ "\n"." $data2 | ".
+ "\n"." ".localtime($ConceptData{'Int.'.($k-1)})." | ".
+ "\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)}).
+# '
To: '.localtime($ConceptData{"Int.$k"}));
+
+# if ( $Max > 1 ) {
+# $Max += (10 - $Max % 10);
+# $Max = int($Max);
+# }
+# else { $Max = 1; }
+ my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.$k : $Src;
+ $GData=$Titr.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;
+ if($ConceptData{'Interval'}>1){
+ $r->print('
');
+ return;
+ }
+ $r->print('
Move your mouse over a bar to find out the concept');
+ my $ptr='';
+ $ptr.="\n".'';
+ $ptr.="\n".''.
+ "\n".'
';
+ $r->print('
'.$ptr.'
');
+}
+
+
+sub AnalyzeProblem {
+# -------------------------------- Selecting the number of intervals
+ my $OpSel='';
+ my $CurInt = $ENV{'form.interval'};
+ if ($CurInt eq '') {$CurMap = '1';}
+ my $Ptr = 'Select number of intervals'."\n".
+ ''."\n";
+ $r->print( $Ptr );
+
+ $r->print('
Option Response Problems in this course:
');
+ my $Str = "\n".'';
+ $Str .= "\n".'';
+ $r->print($Str);
+ $r->rflush();
+}
+
+
+sub Decide {
+ my ($type,$foil,$time)=@_;
+ my $k=0;
+ while ($time>$ConceptData{'Int.'.($k+1)} &&
+ $k<$ConceptData{'Interval'}) {$k++;}
+ $ConceptData{"$foil_to_concept{$foil}.$k.$type"}++;
+}
+
+
+sub OpStatus {
+ my ($rid,$student)=@_;
+ my ($uname,$udom)=split(/\:/,$student);
+ my $code='U';
+ $rid=~/(\d+)\.(\d+)/;
+ my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.
+ &Apache::lonnet::declutter($hash{'src_'.$rid});
+ my %reshash=&Apache::lonnet::restore($symb,$cid,$udom,$uname);
+ my @True = ();
+ my @False = ();
+ my $flag=0;
+ @shown=();
+ if ($reshash{'version'}) {
+ for (my $version=1;$version<=$reshash{'version'};$version++) {
+ my $time=$reshash{"$version:timestamp"};
+ foreach (sort(split(/\:/,$reshash{$version.':keys'}))) {
+ if (($_=~/\.(\w+)\.(\w+)\.submission$/)) {
+ 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.$_"};
+ #$r->print("
shown: ".join(',',@shown)." size=$#shown");
+ if ($submission{$_}) {
+ #if($#shown==-1){
+ #my @str=split(/\&/,$Resp);
+ #my $garb;
+ #for(my $j=0;$j<=$#str;$j++){
+ # ($shown[$j],$garb)=split(/\=/,$str[$j]);
+ #}
+ ##$r->print("
shown: ".join(',',@shown)." size=$#shown");
+ #}
+ if ($submission{$_} eq $Ansr) {
+ &Decide("true",$_,$time );
+ }
+ else {&Decide("false",$_,$time );}
+ }
+ #else {
+ # if ($#shown==-1 && $flag==0) {
+ # $flag++;
+ # &InitAnalysis($rid,$student);
+ # }
+ # my @erl=split(/\:/,$_);
+ # for (my $i=0;$i<=$#shown; $i++){
+ # my $Ans=$Answer{"$Id1.$Id2.foil.value.$shown[$i]"};
+ # if ($erl[$i] eq $Ans) {
+ # &Decide("true",$shown[$i],$time);
+ # }
+ # else {&Decide("false",$shown[$i],$time);}
+ # }
+ #}
+ }
+ }
+ }
+ }
+ }
+}
+
-my %Header = (0,"Problem Title",1,"#Stdnts",2,"Tries",3,"Mod",
- 4,"Mean",5,"#YES",6,"#yes",7,"%Wrng",8,"S.D.",
- 9,"Skew.",10,"DoDiff",11,"Map");
-# 9,"Skew.",10,"DoDiff",11,"Dis.F.",12,"Resourse URL");
+#------- Processing upperlist and lowerlist according to each problem
+sub ProcessDisc {
+ my @List = @_;
+ @List = sort (@List);
+ my $Count = $#List+1;
+ my $Prb;
+ my @Dis;
+ my $Slvd=0;
+ my $tmp;
+ my $Sum1=0;
+ my $Sum2=0;
+ my $nIdx=0;
+ my $nStud=0;
+ my %Proc;
+ undef %Proc;
+ while ($nIdx<$Count) {
+ ($Prb,$tmp)=split(/\=/,$List[$nIdx]);
+ @Dis=split(/\+/,$tmp);
+ my $Temp = $Prb;
+ do {
+ $nIdx++;
+ $nStud++;
+ $Sum1 += $Dis[0];
+ $Sum2 += $Dis[1];
+ ($Prb,$tmp)=split(/\=/,$List[$nIdx]);
+ @Dis=split(/\+/,$tmp);
+ } while ( $Prb eq $Temp && $nIdx < $Count );
+# $Proc{$Temp}=($Sum1/$nStud).':'.$nStud;
+ $Proc{$Temp}=($Sum1/$nStud).':'.($Sum2/$nStud);
+# $r->print("$nIdx) $Temp --> ($nStud) $Proc{$Temp}
");
+ $Sum1=0;
+ $Sum2=0;
+ $nStud=0;
+ }
+ return %Proc;
+}
+
+
+#------- Creating Discimination factor
+sub Discriminant {
+ my $Count=0;
+ foreach (keys(%DiscFac)){
+ $Count++;
+ }
+ $UpCnt = int(0.27*$Count);
+ my $low=0;
+ my $up=$Count-$UpCnt;
+ my @UpList=();
+ my @LowList=();
+ $Count=0;
+ foreach my $key (sort(keys(%DiscFac))){
+ $Count++;
+ #$r->print("
$Count) $key = $DiscFac{$key}");
+ if ($low < $UpCnt || $Count > $up) {
+ $low++;
+ my $str=$DiscFac{$key};
+ foreach(split(/\:/,$str)){
+ if ($_) {
+ if ($low<$UpCnt){push(@LowList,$_);}
+ else {push(@UpList,$_);}
+ }
+ }
+ }
+ }
+ %DisUp=&ProcessDisc(@UpList);
+ %DisLow=&ProcessDisc(@LowList);
+}
+
sub NumericSort {
$a <=> $b;
}
@@ -94,10 +486,9 @@ sub StudentReport {
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;
my $Tries;
my $TotalTries = 0;
@@ -116,13 +507,10 @@ sub StudentReport {
"\n".' Results | '.
"\n".' Tries | '.
"\n".'';
- unless ($reply=~/^error\:/) {
- map {
- my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_));
- $result{$name}=$value;
- } split(/\&/,$reply);;
- foreach $ResId (@cols) {
- if ( !$ResId ) {
+ my ($temp)=keys(%result);
+ unless ($temp=~/^error\:/) {
+ foreach my $CurCol (@cols) {
+ if (!$CurCol){
my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});
if ( $Set ) {
$SetNo++;
@@ -137,6 +525,7 @@ sub StudentReport {
$PtrCod='';
next;
}
+ ($PrOrd,$ResId)=split(/\:/,$CurCol);
$ResId=~/(\d+)\.(\d+)/;
my $Map = &Apache::lonnet::declutter( $hash{'map_id_'.$1} );
if ( $CurMap ne 'All Maps' ) {
@@ -146,25 +535,25 @@ sub StudentReport {
my $meta=$hash{'src_'.$ResId};
my $PartNo = 0;
undef %TempHash;
- map {
- if ($_=~/^stores\_(\d+)\_tries$/) {
+ foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))){
+ if ($_=~/^stores\_(\w+)\_tries$/) {
my $Part=&Apache::lonnet::metadata($meta,$_.'.part');
if ( $TempHash{"$Part"} eq '' ) {
$TempHash{"$Part"} = $Part;
$TempHash{$PartNo}=$Part;
$TempHash{"$Part.Code"} = '-';
+ $TempHash{"$Part.PrOrd"} = $PrOrd+$PartNo;
$PartNo++;
}
}
- } split(/\,/,&Apache::lonnet::metadata($meta,'keys'));
+ }
my $Prob = $Map.'___'.$2.'___'.
&Apache::lonnet::declutter( $hash{'src_'.$ResId} );
$Code='U';
$Tries = 0;
$Wrongs = 0;
- $LatestVersion = $result{"version:$Prob"};
-
+ $LatestVersion = $result{"version:$Prob"};
if ( $LatestVersion ) {
for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) {
my $vkeys = $result{"$Version:keys:$Prob"};
@@ -188,7 +577,7 @@ sub StudentReport {
$TempHash{"$Part.Wrongs"} = $Wrongs;
}
}
- }
+ }
for ( my $n = 0; $n < $PartNo; $n++ ) {
my $part = $TempHash{$n};
if ($PtrTry ne '') {$PtrTry .= ',';}
@@ -210,18 +599,54 @@ sub StudentReport {
$r->rflush();
}
+sub CreateTable {
+ my $ColNo=0;
+ foreach (keys(%Header)){
+ $ColNo++;
+ }
+ my ($Hd, $Hid)=@_;
+ if ( $Hd == 1 ) {
+ $r->print('
'.$hash{'title_'.$Hid}.'');
+ }
+ my $Result = "\n".''."\n");
+ $r->rflush();
+}
+
# ------------------------------------------- Prepare Statistics Table
sub PreStatTable {
my $CacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
"_$ENV{'user.domain'}_$cid\_statistics.db";
my $GraphDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
"_$ENV{'user.domain'}_$cid\_graph.db";
- my $CachDisFac = "/home/httpd/perl/tmp/$ENV{'user.name'}".
- "_$ENV{'user.domain'}_$cid\_DiscFactor.db";
- $r->print('
');
+ my $OpSel11='';
+ my $OpSel12='';
+ my $OpSel13='';
+ my $Status = $ENV{'form.status'};
+ if ( $Status eq 'Any' ) { $OpSel13='selected'; }
+ elsif ($Status eq 'Expired' ) { $OpSel12 = 'selected'; }
+ else { $OpSel11 = 'selected'; }
my $Ptr = '';
+ $Ptr .= '
Student Status: '."\n".
+ ' '."\n";
+ $Ptr .= ' ';
+ $Ptr .= ''."\n";
$Ptr .= '
Sorting Type: '."\n".
'