# The LearningOnline Network with CAPA
# (Publication Handler
#
# $Id: lonstudentassessment.pm,v 1.1 2002/07/24 14:52:32 stredwic 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
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# 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
#
###
package Apache::lonstudentassessment;
use strict;
use Apache::lonhtmlcommon;
use Apache::loncoursedata;
use GDBM_File;
sub BuildStudentAssessmentPage {
my ($cacheDB, $students, $courseID, $c)=@_;
my %cache;
my $Ptr = '';
$Ptr .= '
';
}
return $Ptr;
}
#---- Student Assessment Web Page --------------------------------------------
# ------ Create different Student Report
sub StudentReport {
my ($cache, $name)=@_;
my $Str = '';
if($cache->{$name.':error'} =~ /course/) {
my ($username)=split(':',$name);
$Str .= 'No course data for student ';
$Str .= ''.$username.'. ';
return $Str;
}
$Str .= "
\#
Set Title
";
$Str .= '
Results
Tries
'."\n";
my $codes;
my $attempts;
foreach my $sequence (split(':', $cache->{'orderedSequences'})) {
if($cache->{'StudentAssessmentMap'} ne 'All Maps' &&
$cache->{'StudentAssessmentMap'} ne $cache->{$sequence.':title'}) {
next;
}
$Str .= '
'.$sequence.'
';
$Str .= '
'.$cache->{$sequence.':title'}.'
';
$codes = '';
$attempts = '';
foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
my $problem = $cache->{$problemID.':problem'};
my $LatestVersion = $cache->{$name.':version:'.$problem};
# Output dashes for all the parts of this problem if there
# is no version information about the current problem.
if(!$LatestVersion) {
foreach my $part (split(/\:/,$cache->{$sequence.':'.
$problemID.
':parts'})) {
$codes .= "-,";
$attempts .= "0,";
}
next;
}
my %partData=undef;
# Initialize part data, display skips correctly
# Skip refers to when a student made no submissions on that
# part/problem.
foreach my $part (split(/\:/,$cache->{$sequence.':'.
$problemID.
':parts'})) {
$partData{$part.':tries'}=0;
$partData{$part.':code'}='-';
}
# Looping through all the versions of each part, starting with the
# oldest version. Basically, it gets the most recent
# set of grade data for each part.
for(my $Version=1; $Version<=$LatestVersion; $Version++) {
foreach my $part (split(/\:/,$cache->{$sequence.':'.
$problemID.
':parts'})) {
if(!defined($cache->{$name.":$Version:$problem".
":resource.$part.solved"})) {
# No grade for this submission, so skip
next;
}
my $tries=0;
my $code='U';
$tries = $cache->{$name.":$Version:$problem".
":resource.$part.tries"};
$partData{$part.':tries'}=($tries) ? $tries : 0;
my $val = $cache->{$name.":$Version:$problem".
":resource.$part.solved"};
if ($val eq 'correct_by_student') {$code = 'Y';}
elsif ($val eq 'correct_by_override') {$code = 'y';}
elsif ($val eq 'incorrect_attempted') {$code = 'N';}
elsif ($val eq 'incorrect_by_override'){$code = 'N';}
elsif ($val eq 'excused') {$code = 'x';}
$partData{$part.':code'}=$code;
}
}
# Loop through all the parts for the current problem in the
# correct order and prepare the output
foreach (split(/\:/,$cache->{$sequence.':'.$problemID.
':parts'})) {
$codes .= $partData{$_.':code'}.',';
$attempts .= $partData{$_.':tries'}.',';
}
}
$codes =~ s/,$//;
$attempts =~ s/,$//;
$Str .= '
'.$codes.'
';
$Str .= '
'.$attempts.'
';
$Str .= '
'."\n";
}
$Str .= '
'."\n";
return $Str;
}
#---- END Student Assessment Web Page ----------------------------------------
1;
__END__