version 1.34, 2002/10/30 18:37:00
|
version 1.37, 2002/11/26 16:59:03
|
Line 30
|
Line 30
|
# 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei |
# 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei |
# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei |
# 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei |
# YEAR=2002 |
# 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 |
# 1/22,2/1,2/6,2/25,3/2,3/26,4/7,5/6 Behrouz Minaei |
# 5/12,5/14,5/15,5/19,5/26,7/16,7/25,7/29,8/5 Behrouz Minaei |
# 5/12,5/26,7/16,7/29,8/5,10/31 Behrouz Minaei |
# |
# |
### |
### |
|
|
package Apache::lonproblemstatistics; |
package Apache::lonproblemstatistics; |
|
|
use strict; |
use strict; |
use Apache::lonnet(); |
use Apache::lonnet(); |
Line 43 use Apache::lonhtmlcommon;
|
Line 43 use Apache::lonhtmlcommon;
|
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use GDBM_File; |
use GDBM_File; |
|
|
my $jr; |
|
|
|
sub InitializeProblemStatistics { |
sub InitializeProblemStatistics { |
my ($cacheDB, $students, $courseID, $c, $r)=@_; |
my ($cacheDB, $students, $courseID, $c, $r)=@_; |
my %cache; |
my %cache; |
|
|
$jr = $r; |
|
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('Unable to tie database1.'); |
$r->print('Unable to tie database1.'); |
return ('ERROR', undef); |
return ('ERROR', undef); |
Line 224 sub BuildProblemStatisticsPage {
|
Line 221 sub BuildProblemStatisticsPage {
|
sub BuildGraphicChart { |
sub BuildGraphicChart { |
my ($graph,$cacheDB,$courseDescription,$students,$courseID,$r,$c)=@_; |
my ($graph,$cacheDB,$courseDescription,$students,$courseID,$r,$c)=@_; |
my %cache; |
my %cache; |
my $max = 0; |
my $max; |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
return 'Unable to tie database.7'; |
return 'Unable to tie database.7'; |
} |
} |
|
|
# my @problems = split(':::', $cache{'problemList'}); |
|
|
|
my $title = ''; |
my $title = ''; |
if($graph eq 'DoDiffGraph') { |
if($graph eq 'DoDiffGraph') { |
$title = 'Degree-of-Difficulty'; |
$title = 'Degree-of-Difficulty'; |
Line 238 sub BuildGraphicChart {
|
Line 233 sub BuildGraphicChart {
|
$title = 'Wrong-Percentage'; |
$title = 'Wrong-Percentage'; |
} |
} |
|
|
|
|
# foreach (@problems) { |
|
# my $data = 0; |
|
# if($graph eq 'DoDiffGraph') { |
|
# $data = sprintf("%.2f", $cache{$_.':degreeOfDifficulty'}), |
|
# } else { |
|
# $data = sprintf("%.1f", $cache{$_.':percentWrong'}), |
|
# } |
|
# if($max < $data) { |
|
# $max = $data; |
|
# } |
|
# push(@values, $data); |
|
# } |
|
|
|
|
|
my $count = 1; |
|
my $currentSequence = -1; |
my $currentSequence = -1; |
my $sortProblems = 'Sort Within Sequence'; |
my $sortProblems = 'Sort Within Sequence'; |
|
|
Line 269 sub BuildGraphicChart {
|
Line 248 sub BuildGraphicChart {
|
my ($sequence,$problem,$part)=split(':', $_); |
my ($sequence,$problem,$part)=split(':', $_); |
if($cache{'StatisticsMaps'} ne 'All Maps' && |
if($cache{'StatisticsMaps'} ne 'All Maps' && |
$cache{'StatisticsMaps'} ne $cache{$sequence.':title'}) { |
$cache{'StatisticsMaps'} ne $cache{$sequence.':title'}) { |
next; |
next; |
} |
} |
|
|
if($currentSequence == -1 || |
if( $currentSequence == -1 || |
($sortProblems eq 'Sort Within Sequence' && |
($sortProblems eq 'Sort Within Sequence' && |
$currentSequence != $sequence)) { |
$currentSequence != $sequence)) { |
if($currentSequence ne -1) { |
if($currentSequence != -1) { |
#$r->print('<br>finish a graph<br>'); |
&DrawGraph(\@values,$courseDescription,$title,$max,$r); |
} |
} |
if($sortProblems eq 'Sort Within Sequence') { |
if($sortProblems eq 'Sort Within Sequence') { |
$r->print('<b>'.$cache{$sequence.':title'}.'</b>'); |
$r->print('<br><b>'.$cache{$sequence.':title'}.'</b>'."\n"); |
} |
} |
|
|
my $sendValues = join(',', @values); |
|
my $sendCount = scalar(@values); |
|
|
|
my @GData = ($courseDescription, 'Problems', |
|
$title, $max, $sendCount, $sendValues); |
|
$r->print('</form>'."\n"); |
|
$r->print('<IMG src="/cgi-bin/graph.gif?'. |
|
(join('&', @GData)).'" border="1" />'); |
|
$r->print('<form>'."\n"); |
|
$currentSequence = $sequence; |
$currentSequence = $sequence; |
@values = (); |
@values = (); |
|
$max=0; |
} |
} |
my $data = 0; |
my $data = 0; |
if($graph eq 'DoDiffGraph') { |
if($graph eq 'DoDiffGraph') { |
Line 305 sub BuildGraphicChart {
|
Line 275 sub BuildGraphicChart {
|
$max = $data; |
$max = $data; |
} |
} |
push(@values, $data); |
push(@values, $data); |
|
|
} |
} |
|
|
#$r->print('<br>'); |
|
|
|
untie(%cache); |
untie(%cache); |
|
|
|
&DrawGraph(\@values,$courseDescription,$title,$max,$r); |
|
|
return; |
return; |
} |
} |
|
|
|
|
|
sub DrawGraph { |
|
my ($values,$courseDescription,$title,$Max,$r)=@_; |
|
my $sendValues = join(',', @$values); |
|
my $sendCount = scalar(@$values); |
|
$r->print("<br>The Maximum Value is: $Max"); |
|
if ( $Max > 1 ) { |
|
if ($Max % 10) { |
|
if ( int($Max) < $Max ) { |
|
$Max++; |
|
$Max = int($Max); |
|
} |
|
} |
|
#(10 - $Max % 10); |
|
} else { $Max = 1; } |
|
|
|
my @GData = ('','Problem_number',$title,$Max,$sendCount,$sendValues); |
|
|
|
# $r->print('</form>'."\n"); |
|
$r->print('<br>'."\n"); |
|
$r->print('<IMG src="/cgi-bin/graph.gif?'. |
|
(join('&', @GData)).'" border="1" />'); |
|
# $r->print('<form>'."\n"); |
|
$r->print('<br>'."\n"); |
|
} |
|
|
#---- Problem Statistics Web Page --------------------------------------- |
#---- Problem Statistics Web Page --------------------------------------- |
|
|
sub CreateProblemStatisticsTableHeading { |
sub CreateProblemStatisticsTableHeading { |
Line 664 sub ExtractStudentData {
|
Line 657 sub ExtractStudentData {
|
|
|
sub SortDivideByTries { |
sub SortDivideByTries { |
my ($toSort, $data, $sortOn)=@_; |
my ($toSort, $data, $sortOn)=@_; |
my @orderedData = sort { ($data->{$a.':totalTries'}) ? |
my @orderedData = sort { ($data->{$a.':totalTries'}) ? |
($data->{$a.$sortOn}/$data->{$a.':totalTries'}):0 |
($data->{$a.$sortOn}/$data->{$a.':totalTries'}):0 |
<=> |
<=> |
($data->{$b.':totalTries'}) ? |
($data->{$b.':totalTries'}) ? |