'.
"\n".''.
"\n".' # | '.
"\n".' Problem Title | '.
- "\n".' Resouse | '.
+ "\n".' Resource | '.
"\n".' Address | '.
"\n".'
';
@@ -289,6 +365,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)} &&
@@ -297,6 +374,7 @@ sub Decide {
}
+#restore the student submissions and finding the result
sub OpStatus {
my ($rid,$student)=@_;
my ($uname,$udom)=split(/\:/,$student);
@@ -445,7 +523,7 @@ sub StudentReport {
"\n".' Tries | '.
"\n".'';
my ($temp)=keys(%result);
- unless ($temp=~/^error\:/) {
+ unless ($temp=~/^(con_lost|error|no_such_host)/i) {
foreach my $CurCol (@cols) {
if (!$CurCol){
my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});
@@ -538,7 +616,7 @@ sub StudentReport {
sub CreateTable {
my ($Hd, $Hid)=@_;
- if ($ENV{'form.showcsv'}) {
+ if ($ENV{'form.showcsv'}) {
if ( $Hd == 1 ) {
$r->print('
"'.$hash{'title_'.$Hid}.'","'.$hash{'src_'.$Hid}.'"');
}
@@ -573,6 +651,7 @@ sub CloseTable {
# ------------------------------------------- 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'}".
@@ -605,8 +684,8 @@ sub PreStatTable {
$Ptr .= ''.
' #Stdnts: Total Number of Students opened the problem.
'.
' Tries : Total Number of Tries for solving the problem.
'.
- ' Max : Maximunm Number of Tries for solving the problem.
'.
- ' Avg. : Average Number of the tries. [ Tries / #Stdnts ]
'.
+ ' Mod : Maximunm Number of Tries for solving the problem.
'.
+ ' Mean : 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'.
@@ -614,10 +693,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 - Avg.)^2)) / (#Stdnts-1)'.
+ '[ sqrt(sum((Xi - Mean)^2)) / (#Stdnts-1)'.
' where Xi denotes every student\'s tries ]
'.
' Skew. : Skewness of the students tries.'.
- ' [ (sqrt( sum((Xi - Avg.)^3) / #Stdnts)) / (S.D.^3) ]
'.
+ ' [ (sqrt( sum((Xi - Mean)^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 - '.
@@ -670,15 +749,18 @@ sub usection {
my ($udom,$unam,$courseid,$ActiveFlag)=@_;
$courseid=~s/\_/\//g;
$courseid=~s/^(\w)/\/$1/;
- foreach (split(/\&/,&Apache::lonnet::reply('dump:'.
- $udom.':'.$unam.':roles',
- &Apache::lonnet::homeserver($unam,$udom)))){
- my ($key,$value)=split(/\=/,$_);
- $key=&Apache::lonnet::unescape($key);
+
+ my %result=&Apache::lonnet::dump('roles',$udom,$unam);
+ my ($checkForResult)=keys(%result);
+ if ($checkForResult=~/^(con_lost|error|no_such_host)/i) {
+ return -1;
+ }
+ foreach my $key (keys (%result)) {
+ my $value=$result{$key};
if ($key=~/^$courseid(?:\/)*(\w+)*\_st$/) {
my $section=$1;
if ($key eq $courseid.'_st') { $section=''; }
- my ($dummy,$end,$start)=split(/\_/,&Apache::lonnet::unescape($value));
+ my ($dummy,$end,$start)=split(/\_/,$value);
if ( $ActiveFlag ne 'Any' ) {
my $now=time;
my $notactive=0;
@@ -725,7 +807,7 @@ sub ExtractStudentData {
my $SecLimit;
my $MapLimit;
my ($temp)=keys(%result);
- unless ($temp=~/^error\:/) {
+ unless ($temp=~/^(con_lost|error|no_such_host)/i) {
foreach my $CurCol(@cols) {
($PrOrd,$ResId)=split(/\:/,$CurCol);
if ( !$CurCol ) { next; }
@@ -848,6 +930,7 @@ sub ExtractStudentData {
}
+
# ------------------------------------------------------------ Build page table
sub tracetable {
my ($rid,$beenhere)=@_;
@@ -995,7 +1078,6 @@ sub Build_Statistics {
@list = sort (@list);
-
&Discriminant();
$OpSel2='';
@@ -1135,6 +1217,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++;}
@@ -1295,46 +1378,72 @@ sub initial {
$HWN=$P_Order;
}
+# my $CacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
+# "_$ENV{'user.domain'}_$cid\_classlist.db";
+# if (-e "$CacheDB") {
+# if (tie(%students,'GDBM_File',"$CacheDB",&GDBM_READER,0640)) {
+# &CachClassList();
+# }
+# else {
+# $r->print("Unable to tie hash to db file");
+# }
+# }
+# else {
+# if (tie(%students,'GDBM_File',$CacheDB,&GDBM_WRCREAT,0640)) {
+# &MakeClassList();
+# }
+# else {
+# $r->print("Unable to tie hash to db file");
+# }
+# }
+# untie(%students);
+
sub ClassList {
&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 %result = &Apache::lonnet::dump('classlist',$sdom,$sname);
- my $classlst=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.':classlist',$chome);
+# my %students = &Apache::lonnet::dump('classlist',$cdom,$cnum);
+# $Apache::lonxml::debug=1;
+# &Apache::lonhomework::showhash(%students);
+# $Apache::lonxml::debug=0;
+# my $StudNo = 0;
+# my $now=time;
+# my ($temp)=keys(%students);
+# unless ($temp=~/^error\:/) {
+# foreach my $KeyPoint(sort keys(%students)) {
+
+
my $StudNo = 0;
my $now=time;
- unless ($classlst=~/^error\:/) {
- foreach (sort split(/\&/,$classlst)) {
- my ($name,$value)=split(/\=/,$_);
- my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));
- $name=&Apache::lonnet::unescape($name);
- my ($sname,$sdom)=split(/\:/,$name);
+
+ my %classlist=&Apache::lonnet::dump('classlist',$cdom,$cnum);
+
+ my ($checkForError)=keys(%result);
+ if($checkForError=~/^(con_lost|error|no_such_host)/i) {
+ $r->print('Could not access course data
');
+ } else {
+ foreach my $name (keys (%classlist)) {
+ my $value=$classlist{$name};
+ my ($end,$start)=split(/\:/,$value);
my $active=1;
my $Status=$ENV{'form.status'};
$Status = ($Status) ? $Status : 'Active';
if ( ( ($end) && $now > $end ) &&
- ( ($Status eq 'Active') ) ) { $active=0; }
+ ( ($Status eq 'Active') ) ) { $active=0; }
if ( ($Status eq 'Expired') &&
- ($end == 0 || $now < $end) ) { $active=0; }
+ ($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;
@@ -1344,12 +1453,10 @@ sub ClassList {
$StuBox{$sname}=$sdom;
}
$StudNo++;
- }
+ }
}
}
- else {
- $r->print('Could not access course data
');
- }
+
$r->print("Total number of students : ".($#students+1));
$r->rflush();
# --------------- Find all assessments and put them into some linear-like order
@@ -1387,10 +1494,12 @@ sub Title {
$r->rflush();
}
+
sub CreateForm {
$r->print("\n".'