version 1.66, 2004/02/13 18:25:57
|
version 1.68, 2004/02/16 20:50:03
|
Line 185 sub BuildProblemAnalysisPage {
|
Line 185 sub BuildProblemAnalysisPage {
|
######################################################### |
######################################################### |
sub NumericalResponseAnalysis { |
sub NumericalResponseAnalysis { |
my ($r,$problem,$ProblemData,$Students) = @_; |
my ($r,$problem,$ProblemData,$Students) = @_; |
|
$r->print('<h2>This analysis is not yet supported</h2>'); |
my ($resource,$respid) = ($problem->{'resource'}, |
my ($resource,$respid) = ($problem->{'resource'}, |
$problem->{'respid'}); |
$problem->{'respid'}); |
my $analysis_html; |
my $analysis_html; |
Line 199 sub NumericalResponseAnalysis {
|
Line 200 sub NumericalResponseAnalysis {
|
$r->print($analysis_html); |
$r->print($analysis_html); |
return; |
return; |
} |
} |
my $Answers = &GetStudentAnswers($r,$problem,$Students); |
my ($max,$min) = &GetStudentAnswers($r,$problem,$Students); |
|
$r->print('Maximum = '.$max.' Minimum = '.$min); |
$r->print('<h2>This analysis is not yet supported</h2>'); |
my $max_students = 0; |
|
my %Data; |
|
foreach my $student (@$Students) { |
|
my $answer = $student->{'answer'}; |
|
$Data{$answer}++; |
|
if ($max_students < $Data{$answer}) { |
|
$max_students = $Data{$answer}; |
|
} |
|
} |
|
foreach (5,10,20,25,50,75,100,150,200,250,500,1000,1500,2000,2500,5000) { |
|
if ($max_students < $_) { |
|
$max_students = $_; |
|
last; |
|
} |
|
} |
|
my @Labels = sort {$a <=> $b } keys(%Data); |
|
$r->print('number of labels = '.scalar(@Labels)); |
|
my @PlotData = @Data{@Labels}; |
|
$r->print('number of PlotData = '.scalar(@PlotData)); |
|
my $graph = |
|
&Apache::loncommon::DrawXYGraph('Correct Answer Distribution', |
|
'Correct Answer', |
|
'Number of students', |
|
$max_students, |
|
undef, |
|
\@Labels, |
|
[\@PlotData], |
|
(xskip=>10)); |
|
$r->print($graph); |
|
return; |
} |
} |
|
|
sub GetStudentAnswers { |
sub GetStudentAnswers { |
Line 216 sub GetStudentAnswers {
|
Line 246 sub GetStudentAnswers {
|
'Student Answer Compilation Progress', scalar(@$Students)); |
'Student Answer Compilation Progress', scalar(@$Students)); |
$r->print("<table>\n"); |
$r->print("<table>\n"); |
$r->rflush(); |
$r->rflush(); |
|
my ($min,$max); |
foreach my $student (@$Students) { |
foreach my $student (@$Students) { |
my $sname = $student->{'username'}; |
my $sname = $student->{'username'}; |
my $sdom = $student->{'domain'}; |
my $sdom = $student->{'domain'}; |
my $answer = analyze_problem_as_student($resource, |
my $answer = analyze_problem_as_student($resource, |
$sname,$sdom, |
$sname,$sdom, |
$partid,$respid); |
$partid,$respid); |
$r->print('<tr>'. |
if (! defined($min) || $min > $answer) { |
'<td>'.$sname.'</td>'. |
$min = $answer; |
'<td>'.$sdom.'</td>'. |
} |
'<td>'.$answer.'</td>'. |
if (! defined($max) || $max < $answer) { |
'</tr>'."\n"); |
$max = $answer; |
|
} |
|
# $r->print('<tr>'. |
|
# '<td>'.$sname.'</td>'. |
|
# '<td>'.$sdom.'</td>'. |
|
# '<td>'.$answer.'</td>'. |
|
# '</tr>'."\n"); |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
&mt('last student')); |
&mt('last student')); |
$Answers{$sname.':'.$sdom}=$answer; |
$student->{'answer'} = $answer; |
} |
} |
$r->print("</table>\n"); |
$r->print("</table>\n"); |
$r->rflush(); |
$r->rflush(); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
# close progress window |
# close progress window |
return \%Answers; |
return ($max,$min); |
|
} |
|
|
|
sub build_student_data_worksheet { |
|
my ($workbook,$format) = @_; |
|
my $rows_output = 3; |
|
my $cols_output = 0; |
|
my $worksheet = $workbook->addworksheet('Student Data'); |
|
$worksheet->write($rows_output++,0,'Student Data',$format->{'h3'}); |
|
my @Headers = ('full name','username','domain','section', |
|
"student\nnumber",'identifier'); |
|
$worksheet->write_row($rows_output++,0,\@Headers,$format->{'header'}); |
|
my @Students = @Apache::lonstatistics::Students; |
|
my $studentrows = &Apache::loncoursedata::get_student_data(\@Students); |
|
my %ids; |
|
foreach my $row (@$studentrows) { |
|
my ($mysqlid,$student) = @$row; |
|
$ids{$student}=$mysqlid; |
|
} |
|
foreach my $student (@Students) { |
|
my $name_domain = $student->{'username'}.':'.$student->{'domain'}; |
|
$worksheet->write_row($rows_output++,0, |
|
[$student->{'fullname'}, |
|
$student->{'username'},$student->{'domain'}, |
|
$student->{'section'},$student->{'id'}, |
|
$ids{$name_domain}]); |
|
} |
|
return $worksheet; |
} |
} |
|
|
######################################################### |
######################################################### |
Line 1333 sub build_foil_index {
|
Line 1397 sub build_foil_index {
|
my $a1 = lc($a); |
my $a1 = lc($a); |
my $b1 = lc($b); |
my $b1 = lc($b); |
if (exists($Numbers{$a1})) { |
if (exists($Numbers{$a1})) { |
$a = $Numbers{$a1}; |
$a1 = $Numbers{$a1}; |
} |
} |
if (exists($Numbers{$b1})) { |
if (exists($Numbers{$b1})) { |
$b = $Numbers{$b1}; |
$b1 = $Numbers{$b1}; |
} |
} |
if (($a =~/^\d+$/) && ($b =~/^\d+$/)) { |
if (($a1 =~/^\d+$/) && ($b1 =~/^\d+$/)) { |
return $a <=> $b; |
return $a1 <=> $b1; |
} else { |
} else { |
return $a cmp $b; |
return $a1 cmp $b1; |
} |
} |
}; |
}; |
my @Concepts; |
my @Concepts; |