[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

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


albertel		Tue Aug  2 14:47:26 2005 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - was doing -123 -> -,123 BUG#4110
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.101 loncom/homework/default_homework.lcpm:1.102
--- loncom/homework/default_homework.lcpm:1.101	Wed Jul 13 16:44:29 2005
+++ loncom/homework/default_homework.lcpm	Tue Aug  2 14:47:24 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.101 2005/07/13 20:44:29 albertel Exp $
+# $Id: default_homework.lcpm,v 1.102 2005/08/02 18:47:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -637,12 +637,12 @@
 sub commaformat {
     my ($number,$target) = @_;
     if ($number =~ /\./) {
-	while ($number =~ /([^\.,]+)([^\.,][^\.,][^\.,])([,0-9]*\.[0-9]*)$/) {
-	    $number = $1.','.$2.$3;
+	while ($number =~ /([^0-9]*)([0-9]+)([^\.,][^\.,][^\.,])([,0-9]*\.[0-9]*)$/) {
+	    $number = $1.$2.','.$3.$4;
 	}
     } else {
-	while ($number =~ /([^,]+)([^,][^,][^,])([,0-9]*)$/) {
-	    $number = $1.','.$2.$3;
+	while ($number =~ /^([^0-9]*)([0-9]+)([^,][^,][^,])([,0-9]*)$/) {
+	    $number = $1.$2.','.$3.$4;
 	}
     }
     return $number;