--- loncom/interface/statistics/lonstudentassessment.pm 2002/07/24 14:52:32 1.1
+++ loncom/interface/statistics/lonstudentassessment.pm 2003/02/28 21:19:00 1.30
@@ -1,12 +1,10 @@
# The LearningOnline Network with CAPA
-# (Publication Handler
#
-# $Id: lonstudentassessment.pm,v 1.1 2002/07/24 14:52:32 stredwic Exp $
+# $Id: lonstudentassessment.pm,v 1.30 2003/02/28 21:19:00 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
-#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -26,221 +24,535 @@
# http://www.lon-capa.org/
#
# (Navigate problems for statistical reports
-# YEAR=2001
-# 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
-# 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
-# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei
#
-###
+#######################################################
+#######################################################
+
+=pod
+
+=head1 NAME
+
+lonstudentassessment
+
+=head1 SYNOPSIS
+
+Presents assessment data about a student or a group of students.
+
+=head1 Subroutines
+
+=over 4
+
+=cut
-package Apache::lonstudentassessment;
+#######################################################
+#######################################################
+
+package Apache::lonstudentassessment;
use strict;
+use Apache::lonstatistics;
use Apache::lonhtmlcommon;
use Apache::loncoursedata;
+use Apache::lonnet; # for logging porpoises
use GDBM_File;
+my $Statistics;
+
+#######################################################
+#######################################################
+
+=pod
+
+=item &BuildStudentAssessmentPage()
+
+Inputs:
+
+=over 4
+
+=item $cacheDB The name of the cache file used to store student data
+
+=item $students Array ref containing the name(s) of the students
+selected for display
+
+=item $courseID The ID of the course
+
+=item $formName The name of the html form - 'Statistics'
+
+=item $headings Array ref of headings to show
+
+=item $spacing A string of spaces
+
+=item $studentInformation Array ref of possible headings for student info
+('fullname','section',...)
+
+=item $r Apache Request
+
+=item $c Apache Connection
+
+=back
+
+=cut
+
+#######################################################
+#######################################################
sub BuildStudentAssessmentPage {
- my ($cacheDB, $students, $courseID, $c)=@_;
+ my ($r,$c)=@_;
+ undef($Statistics);
+
+ #
+ $r->print(&CreateInterface());
+ $r->rflush();
+ #
+ $r->print(&CreateTableHeadings());
+ if($c->aborted()) { return ; }
+
+ my $Count = 0;
+ $r->print('
'."\n";
+ return $Str;
+}
+
+
+#######################################################
+#######################################################
+
+=pod
+
+=item Table Output Routines
+
+=over 4
+
+=cut
+
+#######################################################
+#######################################################
+{
+ my $padding;
+
+#######################################################
+#######################################################
+
+=pod
+
+=item &CreateTableHeadings()
+
+Create HTML for the columns of student data to show.
+Called by &BuildStudentAssessmentPage(). Calls
+&Apache::lonhtmlcommon::CreateHeadings().
+
+Inputs:
+
+=over 4
+
+=item $cache The ubiquitous cache
+
+=item $spacing A string of spaces
+
+=item $infoKeys Array ref to names of keys to display from the cache
+which describe students
+
+=item $infoHeadings Array ref to headings of columns for student info
+
+=item $sequenceKeys Array ref of names of keys to use to retrieve sequence
+data from the cache
+
+=item $sequenceHeadings Array ref of names of sequences used for output.
+
+=back
+
+Returns: A string containing the HTML of the table headings.
+
+=cut
+
+#######################################################
+#######################################################
+sub CreateTableHeadings {
+ #
+ $padding = ' 'x3;
+ #
+ my $Str = '
';
+ # First, the @StudentData fields need to be listed
+ my @to_show = @Apache::lonstatistics::SelectedStudentData;
+ foreach (@to_show) {
+ if ($_ eq 'all') {
+ @to_show = @Apache::lonstatistics::StudentDataOrder;
last;
}
}
+ foreach my $field (@to_show) {
+ my $title=$Apache::lonstatistics::StudentData{$field}->{'title'};
+ my $base =$Apache::lonstatistics::StudentData{$field}->{'base_width'};
+ my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
+ $Str .= $title.' 'x($width-$base).$padding;
+ }
+ # Now the selected sequences need to be listed
+ foreach my $map_symb (@Apache::lonstatistics::SelectedMaps) {
+ foreach my $sequence (@Apache::lonstatistics::Sequences) {
+ next if ($sequence->{'symb'} ne $map_symb && $map_symb ne 'all');
+ next if ($sequence->{'num_assess'} < 1);
+ my $title = $sequence->{'title'};
+ my $base = $sequence->{'base_width'};
+ my $width = $sequence->{'width'};
+ $Str .= $title.' 'x($width-$base).$padding;
+ }
+ }
+ $Str .= 'total';
+ $Str .= "
'."\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 .= '
'.$title.
+ '
'.$pCount.
+ '
'.$crr.
+ '
'."\n";
+ }
+
+ $Str .= '
'."\n";
+
+ return $Str;
+}
+
+#######################################################
+#######################################################
+
+=pod
+
+=item &CreateLegend()
+
+This function returns a formatted string containing the legend for the
+chart. The legend describes the symbols used to represent grades for
+problems.
+
+=cut
+
+#######################################################
+#######################################################
+sub CreateLegend {
+ my $Str = "
".
+ " 1 correct by student in 1 try\n".
+ " 7 correct by student in 7 tries\n".
+ " * correct by student in more than 9 tries\n".
+ " + correct by hand grading or override\n".
+ " - incorrect by override\n".
+ " . incorrect attempted\n".
+ " # ungraded attempted\n".
+ " not attempted (blank field)\n".
+ " x excused".
+ "