[LON-CAPA-cvs] cvs: loncom /homework grades.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Wed, 30 Mar 2005 21:11:45 -0000
banghart Wed Mar 30 16:11:45 2005 EDT
Modified files:
/loncom/homework grades.pm
Log:
Saving work, first step of versions for portfolio files.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.250 loncom/homework/grades.pm:1.251
--- loncom/homework/grades.pm:1.250 Thu Mar 3 00:57:26 2005
+++ loncom/homework/grades.pm Wed Mar 30 16:11:44 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.250 2005/03/03 05:57:26 albertel Exp $
+# $Id: grades.pm,v 1.251 2005/03/30 21:11:44 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2113,6 +2113,7 @@
$ENV{'request.course.id'});
if (!&canmodify($usec)) { return('not_allowed'); }
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
+ my @parts_graded;
my %newrecord = ();
my ($pts,$wgt) = ('','');
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
@@ -2147,6 +2148,8 @@
if ($partial eq $record{'resource.'.$_.'.awarded'}) {
#do not update score for part if not changed.
next;
+ } else {
+ push @parts_graded, $_;
}
if ($record{'resource.'.$_.'.awarded'} ne $partial) {
$newrecord{'resource.'.$_.'.awarded'} = $partial;
@@ -2170,12 +2173,27 @@
}
}
if (scalar(keys(%newrecord)) > 0) {
+ &version_portfiles(\%record, \@parts_graded, $ENV{'request.course.id'}, $symb, $domain, $stuname);
&Apache::lonnet::cstore(\%newrecord,$symb,
$ENV{'request.course.id'},$domain,$stuname);
}
return '',$pts,$wgt;
}
+# ----------- Handles creating versions for portfolio files as answers
+sub version_portfiles {
+ my ($record, $parts_graded, $courseid, $symb, $domain, $stuname) = @_;
+ my $parts = join '|', @$parts_graded;
+ foreach my $key (sort keys %$record) {
+ if ($key =~ /^resource\.($parts)\./ && $key =~ /\.portfiles$/) {
+ &Apache::lonnet::logthis('found key portfiles '.$key);
+ &Apache::lonnet::logthis('found value portfiles '.$$record{$key});
+ }
+ }
+
+
+}
+
#--------------------------------------------------------------------------------------
#
#-------------------------- Next few routines handles grading by section or whole class