[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm lonhomework.pm optionresponse.pm response.pm
www
www@source.lon-capa.org
Mon, 07 Mar 2011 19:42:21 -0000
www Mon Mar 7 19:42:21 2011 EDT
Modified files:
/loncom/homework inputtags.pm lonhomework.pm optionresponse.pm
response.pm
Log:
Saving my work: lenient grading. Still problems with saving input after
first try.
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.281 loncom/homework/inputtags.pm:1.282
--- loncom/homework/inputtags.pm:1.281 Sat Mar 5 23:00:45 2011
+++ loncom/homework/inputtags.pm Mon Mar 7 19:42:21 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.281 2011/03/05 23:00:45 raeburn Exp $
+# $Id: inputtags.pm,v 1.282 2011/03/07 19:42:21 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -801,7 +801,7 @@
}
sub decideoutput {
- my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_;
+ my ($award,$awarded,$awardmsg,$solved,$previous,$target,$nocorrect)=@_;
my $message='';
my $button=0;
@@ -819,8 +819,14 @@
my $part = $Apache::inputtags::part;
my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade");
my $handgrade = ('yes' eq lc($tohandgrade));
+#
+# Should "Computer's Answer" be displayed?
+# Should not be displayed if still answerable,
+# if the problem is handgraded,
+# or if the problem does not give a correct answer
+#
- my $computer = ($handgrade)? ''
+ my $computer = ($handgrade || $nocorrect)? ''
: " ".&mt("Computer's answer now shown above.");
&Apache::lonxml::debug("handgrade has :$handgrade:");
@@ -1361,8 +1367,8 @@
}
sub get_grade_messages {
- my ($id,$prefix,$target,$status) = @_;
-
+ my ($id,$prefix,$target,$status,$nocorrect) = @_;
+# nocorrect suppresses "Computer's answer now shown above"
my ($message,$latemessage,$trystr,$previousmsg);
my $showbutton = 1;
@@ -1376,7 +1382,7 @@
&Apache::lonxml::debug('Getting message');
($showbutton,my $css_class,$message,$previousmsg) =
&decideoutput($award,$awarded,$awardmsg,$solved,$previous,
- $target);
+ $target,(($status eq 'CAN_ANSWER') || $nocorrect));
if ($target eq 'tex') {
$message='\vskip 2 mm '.$message.' ';
} else {
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.324 loncom/homework/lonhomework.pm:1.325
--- loncom/homework/lonhomework.pm:1.324 Sat Feb 12 01:36:21 2011
+++ loncom/homework/lonhomework.pm Mon Mar 7 19:42:21 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.324 2011/02/12 01:36:21 www Exp $
+# $Id: lonhomework.pm,v 1.325 2011/03/07 19:42:21 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -438,7 +438,9 @@
# if (correct and show prob status) or excused then CANNOT_ANSWER
if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/
&&
- &show_problem_status())
+ &show_problem_status()
+ &&
+ $Apache::lonhomework::history{"resource.$id.awarded"}==1)
||
$Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {
$status = 'CANNOT_ANSWER';
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.174 loncom/homework/optionresponse.pm:1.175
--- loncom/homework/optionresponse.pm:1.174 Thu Mar 3 21:05:35 2011
+++ loncom/homework/optionresponse.pm Mon Mar 7 19:42:21 2011
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.174 2011/03/03 21:05:35 www Exp $
+# $Id: optionresponse.pm,v 1.175 2011/03/07 19:42:21 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -225,12 +225,11 @@
my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt);
} elsif ( $target eq 'grade') {
+
my $nonlenient=0;
my $part=$Apache::inputtags::part;
my $lenientparm=&Apache::lonnet::EXT("resource.$part.lenient");
- &Apache::lonnet::logthis("Parameter ".$part." ".$lenientparm);
-
if ($Apache::lonhomework::scantronmode) {
$nonlenient=0;
# Grading an exam: we are grading lenient unless told not to
@@ -244,8 +243,8 @@
$nonlenient=0;
}
}
- &Apache::lonnet::logthis("Non-Lenient set to ".$nonlenient);
if ( &Apache::response::submitted()) {
+
my @whichopt = &whichfoils($max,$randomize);
my $temp=1;my $name;
my %responsehash;
@@ -310,7 +309,6 @@
#
# Non-lenient mode. All right or all wrong
#
- &Apache::lonnet::logthis("In non-lenient");
my $ad;
if ($wrong==0 && $ignored==0) {
$ad='EXACT_ANS';
@@ -329,7 +327,6 @@
#
# This is lenient mode
#
- &Apache::lonnet::logthis("This is in lenient mode ... nice");
my $ad;
if ($wrong==0 && $right==0) {
#nothing submitted only assign a score if we
@@ -463,7 +460,6 @@
my $part=$Apache::inputtags::part;
my $id=$Apache::inputtags::response[-1];
my $break;
- my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
if ( ($target ne 'tex') &&
&Apache::response::show_answer() ) {
my $temp=1;
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.221 loncom/homework/response.pm:1.222
--- loncom/homework/response.pm:1.221 Sun Dec 19 00:44:09 2010
+++ loncom/homework/response.pm Mon Mar 7 19:42:21 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.221 2010/12/19 00:44:09 raeburn Exp $
+# $Id: response.pm,v 1.222 2011/03/07 19:42:21 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1140,9 +1140,9 @@
sub show_answer {
my $part = $Apache::inputtags::part;
- my $award = $Apache::lonhomework::history{"resource.$part.solved"};
+ my $award = $Apache::lonhomework::history{"resource.$part.awarded"};
my $status = $Apache::inputtags::status[-1];
- return ( ($award =~ /^correct/
+ return ( ($award ==1
&& &Apache::lonhomework::show_problem_status())
|| $status eq "SHOW_ANSWER");
}