[LON-CAPA-cvs] cvs: loncom /homework essayresponse.pm inputtags.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 19 Apr 2003 09:00:55 -0000
albertel Sat Apr 19 05:00:55 2003 EDT
Modified files:
/loncom/homework essayresponse.pm inputtags.pm
Log:
- saving my work
- I am not sure this is correct yet but it is a step closer,
- New award detail ASSIGNED_SCORE, causes inputtags to grab individual awardeds if exist from all responses and then do ain arithmatic average
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.29 loncom/homework/essayresponse.pm:1.30
--- loncom/homework/essayresponse.pm:1.29 Fri Apr 18 18:27:28 2003
+++ loncom/homework/essayresponse.pm Sat Apr 19 05:00:54 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.29 2003/04/18 22:27:28 albertel Exp $
+# $Id: essayresponse.pm,v 1.30 2003/04/19 09:00:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -107,10 +107,10 @@
my $increase=&Apache::response::getresponse($i+1);
if ($increase ne '') { $score+=$increase+1; }
}
- my $weight = &Apache::lonnet::EXT("resource.$id.weight");
+ my $weight = &Apache::lonnet::EXT("resource.$part.weight");
my $pcr=$score/$weight;
- #FIXME, won't work for multiple essay in a single part
- $Apache::lonhomewok::results{"resource.$id.awarded"}=$pcr;
+ $Apache::lonhomewok::results{"resource.$part.$id.awarded"}=$pcr;
+ $Apache::lonhomewok::results{"resource.$part.$id.awarddetail"}='ASSIGNED_SCORE';
} elsif ( defined($ENV{'form.submitted'}) ) {
my $response = $ENV{'form.HWVAL_'.$id};
my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'};
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.91 loncom/homework/inputtags.pm:1.92
--- loncom/homework/inputtags.pm:1.91 Tue Apr 8 11:18:45 2003
+++ loncom/homework/inputtags.pm Sat Apr 19 05:00:54 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.91 2003/04/08 15:18:45 sakharuk Exp $
+# $Id: inputtags.pm,v 1.92 2003/04/19 09:00:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -252,6 +252,9 @@
foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} }
}
if ($result eq '' ) {
+ foreach $award (@_) { if ($award eq 'ASSIGNED_SCORE') {$result=$award; last;} }
+ }
+ if ($result eq '' ) {
foreach $award (@_) { if ($award eq 'APPROX_ANS') {$result=$award; last;} }
}
if ($result eq '' ) { $result='EXACT_ANS'; }
@@ -267,12 +270,15 @@
if ($previous) { $previousmsg='You have entered that answer before'; }
if ($solved =~ /^correct/) {
- if ($target eq 'tex') {
- $message = '\textbf{You are correct}. Your receipt is '.
- &Apache::lonnet::receipt;
+ if ($award eq 'ASSIGNED_SCORE') {
+ $message = "A score has been assigned.";
} else {
- $message = "<b>You are correct.</b> Your receipt is ".
- &Apache::lonnet::receipt;
+ if ($target eq 'tex') {
+ $message = '\textbf{You are correct}.';
+ } else {
+ $message = "<b>You are correct.</b>";
+ }
+ $message=' Your receipt is '.&Apache::lonnet::receipt;
}
$button=0;
$previousmsg='';
@@ -332,6 +338,9 @@
} elsif ($award eq 'DRAFT') {
$message = "A draft copy has been saved.";
$button=1;
+ } elsif ($award eq 'ASSIGNED_SCORE') {
+ $message = "A score has been assigned.";
+ $button=0;
} else {
$message = "Unknown message: $award";
$button=1;
@@ -366,7 +375,19 @@
if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
$Apache::lonhomework::results{"resource.$id.afterduedate"}='';
}
- if ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
+ if ( $award eq 'ASSIGNED_SCORE') {
+ $Apache::lonhomework::results{"resource.$id.tries"} =
+ $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+ $Apache::lonhomework::results{"resource.$id.solved"} =
+ 'correct_by_student';
+ my $numawards=scalar(@Apache::inputtags::response);
+ $Apache::lonhomework::results{"resource.$id.awarded"} = 0;
+ foreach my $res (@Apache::inputtags::response) {
+ $Apache::lonhomework::results{"resource.$id.awarded"}+=
+ $Apache::lonhomework::results{"resource.$id.$res.awarded"};
+ }
+ $Apache::lonhomework::results{"resource.$id.awarded"}/=$numawards;
+ } elsif ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
$Apache::lonhomework::results{"resource.$id.tries"} =
$Apache::lonhomework::history{"resource.$id.tries"} + 1;
$Apache::lonhomework::results{"resource.$id.solved"} =