";
$r->print($Str);
+#$Apache::lonxml::debug=1;
+#&Apache::lonhomework::showhash(%ConceptData);
+#$Apache::lonxml::debug=0;
+}
-# $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;
+
+sub DrawGraph {
+ my ($k,$Src)=@_;
+ my $Max=0;
+ my @data1;
+ my @data2;
+
+ # Adjust Data and find the Max
+ 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;}
}
- $r->print(' Move your mouse over a bar to find out the concept');
- my $ptr='';
- $ptr.="\n".'';
- $ptr.="\n".'
'.
- "\n".'
';
- $r->print(' '.$ptr.' ');
+ for (my $n=0; $n<=$#Concepts; $n++ ) {
+ if ($data1[$n]+$data2[$n]<$Max) {
+ $data2[$n]+=$Max-($data1[$n]+$data2[$n]);
+ }
+ }
+ my $P_No = $#data1+1;
+
+ if ( $Max > 1 ) {
+ $Max += (10 - $Max % 10);
+ $Max = int($Max);
+ } else { $Max = 1; }
+
+
+ my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.($k+1) : $Src;
+# $GData=$Titr.'&Concepts'.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;
+ $GData="$Titr&Concepts&Answers&$Max&$P_No&".
+ (join(',',@data1)).'&'.(join(',',@data2));
+
+ $r->print('');
}
sub AnalyzeProblem {
-# -------------------------------- Selecting the number of intervals
+ # selecting the number of intervals
my $OpSel='';
my $CurInt = $ENV{'form.interval'};
if ($CurInt eq '') {$CurMap = '1';}
@@ -309,6 +289,7 @@ sub AnalyzeProblem {
$Ptr .= ''."\n";
$r->print( $Ptr );
+ #the table of option response problems
$r->print(' Option Response Problems in this course:
');
my $Str = "\n".'
'.
"\n".'
'.
@@ -339,6 +320,7 @@ sub AnalyzeProblem {
sub Decide {
+ #deciding the true or false answer belongs to each interval
my ($type,$foil,$time)=@_;
my $k=0;
while ($time>$ConceptData{'Int.'.($k+1)} &&
@@ -347,6 +329,7 @@ sub Decide {
}
+#restore the student submissions and finding the result
sub OpStatus {
my ($rid,$student)=@_;
my ($uname,$udom)=split(/\:/,$student);
@@ -358,47 +341,32 @@ sub OpStatus {
my @True = ();
my @False = ();
my $flag=0;
- @shown=();
if ($reshash{'version'}) {
+ my $tries=0;
+ &Apache::lonhomework::showhash(%Answer);
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{$_};
+
+ foreach my $key (sort(split(/\:/,$reshash{$version.':keys'}))) {
+ if (($key=~/\.(\w+)\.(\w+)\.submission$/)) {
+ my $Id1 = $1; my $Id2 = $2;
+ #check if this is a repeat submission, if so skip it
+ if ($reshash{"$version:resource.$Id1.previous"}) { next; }
+ #if no solved this wasn't a real submission, ignore it
+ if (!defined($reshash{"$version:resource.$Id1.solved"})) {
+ &Apache::lonxml::debug("skipping ");
+ next;
+ }
+ my $Resp = $reshash{"$version:$key"};
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);}
- # }
- #}
}
}
}
@@ -602,11 +570,17 @@ sub StudentReport {
}
sub CreateTable {
+ my ($Hd, $Hid)=@_;
+ if ($ENV{'form.showcsv'}) {
+ if ( $Hd == 1 ) {
+ $r->print(' "'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"');
+ }
+ return;
+ }
my $ColNo=0;
foreach (keys(%Header)){
$ColNo++;
}
- my ($Hd, $Hid)=@_;
if ( $Hd == 1 ) {
$r->print(' '.$hash{'title_'.$Hid}.'');
@@ -623,12 +597,16 @@ sub CreateTable {
}
sub CloseTable {
+ if ($ENV{'form.showcsv'}) {
+ return;
+ }
$r->print("\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'}".
@@ -661,8 +639,8 @@ sub PreStatTable {
$Ptr .= '
'.
' #Stdnts: Total Number of Students opened the problem. '.
' Tries : Total Number of Tries for solving the problem. '.
- ' Mod : Maximunm Number of Tries for solving the problem. '.
- ' Mean : Average Number of the tries. [ Tries / #Stdnts ] '.
+ ' Max : Maximunm Number of Tries for solving the problem. '.
+ ' Avg. : Average Number of the tries. [ Tries / #Stdnts ] '.
' #YES : Number of students solved the problem correctly. '.
' #yes : Number of students solved the problem by override. '.
' %Wrng : Percentage of students tried to solve the problem but'.
@@ -670,10 +648,10 @@ sub PreStatTable {
# ' DoDiff : Degree of Difficulty of the problem. [ Tries/(#YES+#yes+0.1) ] '. Kashy formula
' DoDiff : Degree of Difficulty of the problem. [ 1 - ((#YES+#yes) / Tries) ] '. #Gerd formula
' S.D. : Standard Deviation of the tries.'.
- '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)'.
+ '[ sqrt(sum((Xi - Avg.)^2)) / (#Stdnts-1)'.
' where Xi denotes every student\'s tries ] '.
' Skew. : Skewness of the students tries.'.
- ' [ (sqrt( sum((Xi - Mean)^3) / #Stdnts)) / (S.D.^3) ] '.
+ ' [ (sqrt( sum((Xi - Avg.)^3) / #Stdnts)) / (S.D.^3) ] '.
' Dis.F. : Discrimination Factor: A Standard for '.
'evaluating the problem according to a Criterion '.
' [Applied Criterion in %27 Upper Students - '.
@@ -685,6 +663,11 @@ sub PreStatTable {
'
';
$r->print($Ptr);
+
+ $r->print('Output CSV format: print(' checked'); }
+ $r->print('>');
+
$r->rflush();
if ((-e "$CacheDB")&&($ENV{'form.sort'} ne 'Recalculate Statistics')) {
@@ -1046,7 +1029,6 @@ sub Build_Statistics {
@list = sort (@list);
-
&Discriminant();
$OpSel2='';
@@ -1186,6 +1168,7 @@ sub Cache_Statistics {
my @list = ();
my $Useful;
my $UnUseful;
+# $r->print(''."\n");
my %myHeader = reverse( %Header );
$Pos = $myHeader{$ENV{'form.sort'}};
if ($Pos > 0) {$Pos++;}
@@ -1234,7 +1217,28 @@ sub TableRow {
my ($Str,$Idx,$RealIdx)=@_;
my($PrOrd,$Temp,$StdNo,$TotalTries,$MxTries,$Avg,$YES,$Override,
$Wrng,$DoD,$SD,$Sk,$_D1,$_D2,$Prob)=split(/\&/,$Str);
- my $Ptr = "\n".'