[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 02 Aug 2005 19:01:18 -0000


albertel		Tue Aug  2 15:01:18 2005 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - fmt=$0f" with no unit was throwing 'computer answer wrong' errors incorrectly
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.176 loncom/homework/caparesponse/caparesponse.pm:1.177
--- loncom/homework/caparesponse/caparesponse.pm:1.176	Thu Jul 14 01:50:33 2005
+++ loncom/homework/caparesponse/caparesponse.pm	Tue Aug  2 15:01:18 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.176 2005/07/14 05:50:33 albertel Exp $
+# $Id: caparesponse.pm,v 1.177 2005/08/02 19:01:18 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -389,6 +389,7 @@
 		if ($unit=~/\$/) { $fmt="\$".$fmt; $unit=~s/\$//g; }
 		if ($unit=~/\,/) { $fmt="\,".$fmt; $unit=~s/\,//g; }
 		$ans = &format_number($ans,$fmt,$target,$safeeval);
+		if ($fmt=~/\$/ && $unit!~/\$/) { $ans=~s/\$//; }
 	    }
 	    push(@fmt_ans,$ans);
 	}