version 1.35, 2002/11/01 22:09:39
|
version 1.40, 2003/02/25 20:47:47
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# (Publication Handler |
|
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 35
|
Line 34
|
# |
# |
### |
### |
|
|
package Apache::lonproblemstatistics; |
package Apache::lonproblemstatistics; |
|
|
use strict; |
use strict; |
use Apache::lonnet(); |
use Apache::lonnet(); |
Line 185 sub BuildProblemStatisticsPage {
|
Line 184 sub BuildProblemStatisticsPage {
|
$Ptr .= '<td align="left">'."\n"; |
$Ptr .= '<td align="left">'."\n"; |
my @sections = split(':',$cache{'sectionList'}); |
my @sections = split(':',$cache{'sectionList'}); |
my @sectionsSelected = split(':',$cache{'sectionsSelected'}); |
my @sectionsSelected = split(':',$cache{'sectionsSelected'}); |
$Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections, |
$Ptr .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); |
\@sectionsSelected, |
|
'Statistics'); |
|
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= '</td></tr>'."\n"; |
$Ptr .= &ProblemStatisticsButtons($cache{'DisplayFormat'}, |
$Ptr .= &ProblemStatisticsButtons($cache{'DisplayFormat'}, |
$cache{'DisplayLegend'}, |
$cache{'DisplayLegend'}, |
Line 221 sub BuildProblemStatisticsPage {
|
Line 218 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)) { |
|
return 'Unable to tie database.7'; |
|
} |
|
|
|
my $title = ''; |
my $title = ''; |
if($graph eq 'DoDiffGraph') { |
if($graph eq 'DoDiffGraph') { |
Line 244 sub BuildGraphicChart {
|
Line 238 sub BuildGraphicChart {
|
|
|
my @values = (); |
my @values = (); |
|
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
|
return 'Unable to tie database.7'; |
|
} |
|
|
foreach(@$orderedProblems) { |
foreach(@$orderedProblems) { |
my ($sequence,$problem,$part)=split(':', $_); |
my ($sequence,$problem,$part)=split(':', $_); |
if($cache{'StatisticsMaps'} ne 'All Maps' && |
if($cache{'StatisticsMaps'} ne 'All Maps' && |
Line 258 sub BuildGraphicChart {
|
Line 256 sub BuildGraphicChart {
|
&DrawGraph(\@values,$courseDescription,$title,$max,$r); |
&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"); |
} |
} |
|
|
$currentSequence = $sequence; |
$currentSequence = $sequence; |
@values = (); |
@values = (); |
|
$max=0; |
} |
} |
my $data = 0; |
my $data = 0; |
if($graph eq 'DoDiffGraph') { |
if($graph eq 'DoDiffGraph') { |
Line 287 sub DrawGraph {
|
Line 286 sub DrawGraph {
|
my ($values,$courseDescription,$title,$Max,$r)=@_; |
my ($values,$courseDescription,$title,$Max,$r)=@_; |
my $sendValues = join(',', @$values); |
my $sendValues = join(',', @$values); |
my $sendCount = scalar(@$values); |
my $sendCount = scalar(@$values); |
|
$r->print("<br>The Maximum Value is: $Max"); |
if ( $Max > 1 ) { |
if ( $Max > 1 ) { |
if ($Max % 10) { |
if ($Max % 10) { |
$Max++; |
if ( int($Max) < $Max ) { |
|
$Max++; |
|
$Max = int($Max); |
|
} |
} |
} |
#(10 - $Max % 10); |
#(10 - $Max % 10); |
$Max = int($Max); |
|
} else { $Max = 1; } |
} else { $Max = 1; } |
|
|
my @GData = ($courseDescription, 'Problem_number', |
my @GData = ('','Problem_number',$title,$Max,$sendCount,$sendValues); |
$title, $Max, $sendCount, $sendValues); |
|
$r->print('</form>'."\n"); |
# $r->print('</form>'."\n"); |
$r->print('<IMG src="/cgi-bin/graph.gif?'. |
$r->print('<br>'."\n"); |
|
$r->print('<IMG src="/cgi-bin/graph.png?'. |
(join('&', @GData)).'" border="1" />'); |
(join('&', @GData)).'" border="1" />'); |
$r->print('<form>'."\n"); |
# $r->print('<form>'."\n"); |
|
$r->print('<br>'."\n"); |
} |
} |
|
|
#---- Problem Statistics Web Page --------------------------------------- |
#---- Problem Statistics Web Page --------------------------------------- |
Line 331 sub BuildStatisticsTable {
|
Line 334 sub BuildStatisticsTable {
|
my $count = 1; |
my $count = 1; |
my $currentSequence = -1; |
my $currentSequence = -1; |
foreach(@$orderedProblems) { |
foreach(@$orderedProblems) { |
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; |
Line 652 sub ExtractStudentData {
|
Line 655 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'}) ? |