version 1.22, 2002/12/18 20:02:34
|
version 1.27, 2003/01/13 01:34:11
|
Line 30
|
Line 30
|
# 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/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei |
# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei |
# 5/12,5/14,5/15,5/19,5/26,7/16,12/24 Behrouz Minaei |
# |
# YEAR=2003 |
|
# 1/11 Behrouz Minaei |
### |
### |
|
|
package Apache::lonstudentassessment; |
package Apache::lonstudentassessment; |
Line 41 use Apache::lonhtmlcommon;
|
Line 42 use Apache::lonhtmlcommon;
|
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use GDBM_File; |
use GDBM_File; |
|
|
#my $jr; |
|
|
|
sub BuildStudentAssessmentPage { |
sub BuildStudentAssessmentPage { |
my ($cacheDB,$students,$courseID,$formName,$headings,$spacing, |
my ($cacheDB,$students,$courseID,$formName,$headings,$spacing, |
$studentInformation,$r,$c)=@_; |
$studentInformation,$r,$c)=@_; |
# $jr = $r; |
|
my %cache; |
my %cache; |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$r->print('<html><body>Unable to tie database.</body></html>'); |
$r->print('<html><body>Unable to tie database.</body></html>'); |
Line 101 sub BuildStudentAssessmentPage {
|
Line 100 sub BuildStudentAssessmentPage {
|
if($c->aborted()) { return $Str; } |
if($c->aborted()) { return $Str; } |
|
|
my $selected=0; |
my $selected=0; |
|
my $Count = 0; |
$r->print('<pre>'."\n"); |
$r->print('<pre>'."\n"); |
foreach (@$students) { |
foreach (@$students) { |
if($c->aborted()) { return $Str; } |
if($c->aborted()) { return $Str; } |
Line 132 sub BuildStudentAssessmentPage {
|
Line 132 sub BuildStudentAssessmentPage {
|
push(@before, $_); |
push(@before, $_); |
} |
} |
} |
} |
my $displayString = 'DISPLAYDATA'.$spacing; |
$Count++; |
$r->print(&Apache::lonhtmlcommon::FormatStudentInformation( |
my $out = ''; |
|
$out .= sprintf("%3d) ", $Count); |
|
if($Count % 2) { |
|
$out .= '<bgcolor="#FFFFFF">'; |
|
} else { |
|
$out .= '<bgcolor="#505050">'; |
|
} |
|
my $displayString = $out.'DISPLAYDATA'.$spacing; |
|
$r->print(&Apache::lonhtmlcommon::FormatStudentInformation( |
\%cache, $_, |
\%cache, $_, |
\@before, |
\@before, |
$displayString, |
$displayString, |
Line 164 sub BuildStudentAssessmentPage {
|
Line 172 sub BuildStudentAssessmentPage {
|
untie(%cache); |
untie(%cache); |
} |
} |
} |
} |
|
$r->print('</pre>'."\n"); |
# if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
|
# $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys)); |
|
# untie(%cache); |
|
# } |
|
$r->print('</pre>'."\n"); |
|
if($selected == 0) { |
if($selected == 0) { |
$Str .= '<h3><font color=blue>WARNING: '; |
$Str .= '<h3><font color=blue>WARNING: '; |
$Str .= 'Please select a student</font></h3>'; |
$Str .= 'No Students enrolled OR Please select a student</font></h3>'; |
$r->print($Str); |
$r->print($Str); |
|
} else { |
|
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
|
$r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys)); |
|
untie(%cache); |
|
} |
} |
} |
|
|
return; |
return; |
} |
} |
|
|
|
|
|
|
|
|
#---- Student Assessment Web Page -------------------------------------------- |
#---- Student Assessment Web Page -------------------------------------------- |
|
|
sub CreateInterface { |
sub CreateInterface { |
Line 238 sub CreateTableHeadings {
|
Line 243 sub CreateTableHeadings {
|
my($cache,$spacing,$infoKeys,$infoHeadings,$sequenceKeys, |
my($cache,$spacing,$infoKeys,$infoHeadings,$sequenceKeys, |
$sequenceHeadings)=@_; |
$sequenceHeadings)=@_; |
|
|
|
# my $Str = '     '; |
my $Str = ''; |
my $Str = ''; |
$Str .= '<table border="0" cellpadding="0" cellspacing="0">'."\n"; |
$Str .= '<table border="0" cellpadding="0" cellspacing="0">'."\n"; |
|
|
$Str .= '<tr>'."\n"; |
$Str .= '<tr>'."\n"; |
|
$Str .= '<td><pre> </pre></td>'."\n"; |
$Str .= &CreateColumnSelectors($infoHeadings, $sequenceHeadings, |
$Str .= &CreateColumnSelectors($infoHeadings, $sequenceHeadings, |
$sequenceKeys); |
$sequenceKeys); |
$Str .= '<td></td></tr>'."\n"; |
$Str .= '<td></td></tr>'."\n"; |
|
|
$Str .= '<tr>'."\n"; |
$Str .= '<tr>'."\n"; |
my $displayString = '<td align="left"><pre><a href="/adm/statistics?'; |
my $displayString = ''; |
|
$displayString .= '<td><pre> </pre></td>'."\n"; |
|
$displayString .= '<td align="left"><pre><a href="/adm/statistics?'; |
$displayString .= 'sort=LINKDATA">DISPLAYDATA</a>FORMATTING'; |
$displayString .= 'sort=LINKDATA">DISPLAYDATA</a>FORMATTING'; |
$displayString .= $spacing.'</pre></td>'."\n"; |
$displayString .= $spacing.'</pre></td>'."\n"; |
$Str .= &Apache::lonhtmlcommon::CreateHeadings($cache, |
$Str .= &Apache::lonhtmlcommon::CreateHeadings($cache, |
Line 400 sub StudentReport {
|
Line 408 sub StudentReport {
|
|
|
sub StudentAverageTotal { |
sub StudentAverageTotal { |
my ($cache, $students, $sequenceKeys)=@_; |
my ($cache, $students, $sequenceKeys)=@_; |
my $Str = "\nAverageTotal\n"; |
my $Str = "\n<b>Summary Tables:</b>\n"; |
my %Correct = (); |
my %Correct = (); |
my $ProblemsSolved = 0; |
my $ProblemsSolved = 0; |
my $TotalProblems = 0; |
my $TotalProblems = 0; |
Line 409 sub StudentAverageTotal {
|
Line 417 sub StudentAverageTotal {
|
foreach my $name (@$students) { |
foreach my $name (@$students) { |
$StudentCount++; |
$StudentCount++; |
foreach my $sequence (@$sequenceKeys) { |
foreach my $sequence (@$sequenceKeys) { |
$Correct{$cache->{$sequence.':title'}} += |
$Correct{$sequence} += |
$cache->{$name.':'.$sequence.':problemsCorrect'}; |
$cache->{$name.':'.$sequence.':problemsCorrect'}; |
} |
} |
$ProblemsSolved += $cache->{$name.':problemsSolved'}; |
$ProblemsSolved += $cache->{$name.':problemsSolved'}; |
$TotalProblems += $cache->{$name.':totalProblems'}; |
$TotalProblems += $cache->{$name.':totalProblems'}; |
} |
} |
$ProblemsSolved /= $StudentCount; |
if ($StudentCount) { |
$TotalProblems /= $StudentCount; |
$ProblemsSolved = sprintf( "%.2f", |
$Str .= "AvgSlvd:$ProblemsSolved AvgTotal: $TotalProblems\n"; |
$ProblemsSolved/$StudentCount); |
|
$TotalProblems /= $StudentCount; |
foreach (%Correct) { |
} else { |
$Str .= "$_ : $Correct{$_}\n"; |
$ProblemsSolved = 0; |
|
$TotalProblems = 0; |
} |
} |
|
|
|
$Str .= '<table border=2 cellspacing="1">'."\n"; |
|
$Str .= '<tr><td><b>Students Count</b></td><td><b>'. |
|
$StudentCount.'</b></td></tr>'."\n"; |
|
$Str .= '<tr><td><b>Total Problems</b></td><td><b>'. |
|
$TotalProblems.'</b></td></tr>'."\n"; |
|
$Str .= '<tr><td><b>Average Correct</b></td><td><b>'. |
|
$ProblemsSolved.'</b></td></tr>'."\n"; |
|
$Str .= '</table>'."\n"; |
|
|
|
$Str .= '<table border=2 cellspacing="1">'."\n"; |
|
$Str .= '<tr><th>Title</th><th>Total Problems</th>'. |
|
'<th>Average Correct</th></tr>'."\n"; |
|
foreach my $S(@$sequenceKeys) { |
|
my $title=$cache->{$S.':title'}; |
|
#$Str .= $cache->{$S.':problems'}; |
|
#my @problems=split(':', $cache->{$S.':problems'}); |
|
#my $pCount=scalar @problems; |
|
my $pCount=MaxSeqPr($cache,@$students[0],$S); |
|
my $crr; |
|
if ($StudentCount) { |
|
$crr=sprintf( "%.2f", $Correct{$S}/$StudentCount ); |
|
} else { |
|
$crr="0.00"; |
|
} |
|
$Str .= '<tr><td>'.$title. |
|
'</td><td align=center>'.$pCount. |
|
'</td><td align=center>'.$crr. |
|
'</td></tr>'."\n"; |
|
} |
|
|
|
$Str .= '</table>'."\n"; |
|
|
return $Str; |
return $Str; |
} |
} |
|
|
|
|
|
|
|
sub MaxSeqPr { |
|
my ($cache, $name, $sequence)=@_; |
|
my $prCount=0; |
|
foreach my $problemID (split(':', $cache->{$sequence.':problems'})) { |
|
my $problem = $cache->{$problemID.':problem'}; |
|
foreach(split(/\:/,$cache->{$sequence.':'.$problemID.':parts'})) { |
|
if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' || |
|
$cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' || |
|
$cache->{$name.':'.$problemID.':'.$_.':code'} eq '') { |
|
$prCount++; |
|
next; |
|
} |
|
$prCount++; |
|
} |
|
} |
|
return $prCount; |
|
} |
|
|
|
|
|
|
|
|
|
|
=pod |
=pod |
|
|
=item &CreateLegend() |
=item &CreateLegend() |