[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm
minaeibi
lon-capa-cvs@mail.lon-capa.org
Sun, 19 May 2002 15:44:40 -0000
minaeibi Sun May 19 11:44:40 2002 EDT
Modified files:
/loncom/interface lonstatistics.pm
Log:
Frequent graphs in Problem analysis showed horizentally according to different intervals.
Added drawing tables to option respose problems.
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.19 loncom/interface/lonstatistics.pm:1.20
--- loncom/interface/lonstatistics.pm:1.19 Wed May 15 21:27:05 2002
+++ loncom/interface/lonstatistics.pm Sun May 19 11:44:40 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonstatistics.pm,v 1.19 2002/05/16 01:27:05 minaeibi Exp $
+# $Id: lonstatistics.pm,v 1.20 2002/05/19 15:44:40 minaeibi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,7 +31,7 @@
# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
# YEAR=2002
# 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
-# 5/12, 5/14, 5/15 Behrouz Minaei
+# 5/12,5/14,5/15,5/19 Behrouz Minaei
#
###
@@ -174,6 +174,9 @@
for (my $k=0; $k<$Int_No; $k++ ) {
&DrawGraph($k,$Src);
}
+ for (my $k=0; $k<$Int_No; $k++ ) {
+ &DrawTable($k);
+ }
#$Apache::lonxml::debug=1;
#&Apache::lonhomework::showhash(%ConceptData);
#$Apache::lonxml::debug=0;
@@ -182,14 +185,13 @@
}
-sub DrawGraph {
- my ($k,$Src)=@_;
+sub DrawTable {
+ my $k=shift;
my $Max=0;
my @data1;
my @data2;
my $Correct=0;
my $Wrong=0;
- # Adjust Data and find the Max
for (my $n=0; $n<=$#Concepts; $n++ ) {
my $tmp=$Concepts[$n];
$data1[$n]=$ConceptData{"$tmp.$k.true"};
@@ -223,17 +225,39 @@
"\n"."<td bgcolor=#FFDDDD> ".$data2[$n]." </td>".
"\n"."</tr>";
}
+ $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.'.$k}).
+ '] To: ['.localtime($ConceptData{'Int.'.($k+1)}-1).
+ "]</b></td><td>$Correct</td><td>$Wrong</td>";
+
+ $Str .= "\n".'</table>';
+
+ $r->print($Str);
#$Apache::lonxml::debug=1;
#&Apache::lonhomework::showhash(%ConceptData);
#$Apache::lonxml::debug=0;
+}
-# $Str.='<td></td><td><b>From:['.localtime($ConceptData{'Int.$k'}).
-# '] To: ['.localtime($ConceptData{'Int.'.($k+1)}).
-# "]</b></td><td>$Correct</td><td>$Wrong</td>";#
- $Str .= "\n".'</table>';
+sub DrawGraph {
+ my ($k,$Src)=@_;
+ my $Max=0;
+ my @data1;
+ my @data2;
-# $r->print($Str);
+ # 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;}
+ }
+ 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);
@@ -547,7 +571,7 @@
sub CreateTable {
my ($Hd, $Hid)=@_;
- if ($ENV{'form.showcsv'}) {
+ if ($ENV{'form.showcsv'}) {
if ( $Hd == 1 ) {
$r->print('<br>"'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"');
}
@@ -1144,9 +1168,8 @@
my @list = ();
my $Useful;
my $UnUseful;
+# $r->print('<input type="hidden" name="show" value="excel" />'."\n");
my %myHeader = reverse( %Header );
- #&Apache::lonnet::delenv('form_');
- #&Apache::lonnet::delenv('test');
$Pos = $myHeader{$ENV{'form.sort'}};
if ($Pos > 0) {$Pos++;}
$p_count = 0;
@@ -1347,7 +1370,10 @@
# my ($temp)=keys(%students);
# unless ($temp=~/^error\:/) {
# foreach my $KeyPoint(sort keys(%students)) {
+
+
my $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome);
+
my $StudNo = 0;
my $now=time;
unless ($classlst=~/^error\:/) {
@@ -1408,74 +1434,6 @@
}
-sub ClassListnew {
-
- &GetStatus();
-
- $cid=$ENV{'request.course.id'};
- my $chome=$ENV{'course.'.$cid.'.home'};
- my ($cdom,$cnum)=split(/\_/,$cid);
-# ----------------------- Get first and last resource, see if there is anything
- $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};
- $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};
- if (($firstres) && ($lastres)) {
-
- my %students = &Apache::lonnet::dump('classlist',$cdom,$cnum);
- my $StudNo = 0;
- my $now=time;
- my ($temp)=keys(%students);
- unless ($temp=~/^error\:/) {
- foreach (sort keys(%students)) {
- my ($name,$value)=split(/\=/,$_);
- my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));
- $name=&Apache::lonnet::unescape($name);
- my ($sname,$sdom)=split(/\:/,$name);
- my $active=1;
- my $Status=$ENV{'form.status'};
- $Status = ($Status) ? $Status : 'Active';
- if ( ( ($end) && $now > $end ) &&
- ( ($Status eq 'Active') ) ) { $active=0; }
- if ( ($Status eq 'Expired') &&
- ($end == 0 || $now < $end) ) { $active=0; }
- if ($active) {
- my $thisindex=$#students+1;
- $name=&Apache::lonnet::unescape($name);
- $students[$thisindex]=$name;
- my ($sname,$sdom)=split(/\:/,$name);
- #my %reply=&Apache::lonnet::idrget($sdom,$sname);
- #my $reply=&Apache::lonnet::reply('get:'.$sdom.':'.$sname.
- # ':environment:lastname&generation&firstname&middlename',
- # &Apache::lonnet::homeserver($sname,$sdom));
- my $ssec=&usection($sdom,$sname,$cid,$Status);
-# if ($ssec==-1 ) {next;}
- if ($ssec==-1 || $ssec eq 'adm' ) {next;}
- $ssec=($ssec) ? $ssec : '(none)';
- #$ssec=(int($ssec)) ? int($ssec) : $ssec;
- $section{$ssec}=$ssec;
- if ($CurSec eq 'All Sections' || $ssec eq $CurSec) {
- $students[$StudNo]=$name;
- $StuBox{$sname}=$sdom;
- }
- $StudNo++;
- }
- }
- }
- else {
- $r->print('<h1>Could not access course data</h1>');
- }
- $r->print("Total number of students : ".($#students+1));
- $r->rflush();
-# --------------- Find all assessments and put them into some linear-like order
- &tracetable($firstres,'&'.$lastres.'&');
- }
-
-# ------------------------------------------------------------- End render page
- else {
- $r->print('<h3>Undefined course sequence</h3>');
- }
-}
-
-
sub Title {
$r->print('<html><head><title>LON-CAPA Statistics</title></head>');
$r->print('<body bgcolor="#FFFFFF">'.
@@ -1493,8 +1451,8 @@
sub CreateForm {
$r->print("\n".'<form name=stat method=post action="/adm/statistics" >');
my $content = $ENV{'form.sort'};
- if (!($ENV{'form.showcsv'}) && #|| !($ENV{'csv'})) &&
- ($content eq '' || $content eq 'Return to Menu')) {
+ if (!($ENV{'form.showcsv'}) &&
+ ($content eq '' || $content eq 'Return to Menu')) {
my $Ptr = '<h3>';
$Ptr .= '<input type=submit name=sort value="Problem Stats"/>';
$Ptr .= '<br><br>';