[LON-CAPA-cvs] cvs: loncom /homework externalresponse.pm loncapagrade.pm /homework/templates sampleexternal.pl
www
www@source.lon-capa.org
Fri, 29 Apr 2011 00:32:11 -0000
www Fri Apr 29 00:32:11 2011 EDT
Modified files:
/loncom/homework externalresponse.pm loncapagrade.pm
/loncom/homework/templates sampleexternal.pl
Log:
Bug #6452: partial correctness from externalresponse
Index: loncom/homework/externalresponse.pm
diff -u loncom/homework/externalresponse.pm:1.18 loncom/homework/externalresponse.pm:1.19
--- loncom/homework/externalresponse.pm:1.18 Tue Dec 21 01:53:08 2010
+++ loncom/homework/externalresponse.pm Fri Apr 29 00:32:08 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# external style responses
#
-# $Id: externalresponse.pm,v 1.18 2010/12/21 01:53:08 www Exp $
+# $Id: externalresponse.pm,v 1.19 2011/04/29 00:32:08 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -118,6 +118,10 @@
$Apache::externalresponse::message=$Apache::loncapagrade::results{'message'};
&Apache::response::handle_previous(\%previous,
$Apache::loncapagrade::results{'awarddetail'});
+ if ($Apache::loncapagrade::results{'awarddetail'} eq 'ASSIGNED_SCORE') {
+ $Apache::lonhomework::results{"resource.$part.$id.awarded"}=
+ 1.*$Apache::loncapagrade::results{"awarded"};
+ }
&Apache::lonxml::debug("response of");
&Apache::lonhomework::showhash(%$res);
&Apache::lonxml::debug("capagrade of");
Index: loncom/homework/loncapagrade.pm
diff -u loncom/homework/loncapagrade.pm:1.6 loncom/homework/loncapagrade.pm:1.7
--- loncom/homework/loncapagrade.pm:1.6 Thu Nov 20 15:19:15 2008
+++ loncom/homework/loncapagrade.pm Fri Apr 29 00:32:08 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# external style responses
#
-# $Id: loncapagrade.pm,v 1.6 2008/11/20 15:19:15 jms Exp $
+# $Id: loncapagrade.pm,v 1.7 2011/04/29 00:32:08 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,7 +47,7 @@
if ($target eq 'grade') {
undef(%Apache::loncapagrade::results);
&Apache::lonxml::register('Apache::loncapagrade',
- ('awarddetail','message'));
+ ('awarddetail','message','awarded'));
}
return $result;
}
@@ -57,7 +57,7 @@
my $result;
if ($target eq 'grade') {
&Apache::lonxml::deregister('Apache::loncapagrade',
- ('loncapagrade','awarddetail','message'));
+ ('loncapagrade','awarddetail','message','awarded'));
}
return $result;
}
@@ -79,6 +79,24 @@
return $result;
}
+sub start_awarded {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ my $result;
+ if ($target eq 'grade') { &Apache::lonxml::startredirection(); }
+ return $result;
+}
+
+sub end_awarded {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ my $result;
+ if ($target eq 'grade') {
+ $Apache::loncapagrade::results{'awarded'}=
+ &Apache::lonxml::endredirection();
+ }
+ return $result;
+}
+
+
sub start_message {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
Index: loncom/homework/templates/sampleexternal.pl
diff -u loncom/homework/templates/sampleexternal.pl:1.1 loncom/homework/templates/sampleexternal.pl:1.2
--- loncom/homework/templates/sampleexternal.pl:1.1 Mon Dec 20 18:14:18 2010
+++ loncom/homework/templates/sampleexternal.pl Fri Apr 29 00:32:11 2011
@@ -83,12 +83,16 @@
# 'EXACT_ANS','COMMA_FAIL'
#
# plus a free-form $message.
-
+#
+# For partial correctness, awarddetail needs to be ASSIGNED_SCORE
+# The partial score would be in <awarded>
+#
print (<<ENDOUT);
<loncapagrade>
<awarddetail>$award</awarddetail>
<message>$message</message>
+ <awarded></awarded>
</loncapagrade>
ENDOUT
exit;