[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 06 Jun 2007 17:03:54 -0000
albertel Wed Jun 6 13:03:54 2007 EDT
Modified files:
/loncom/homework/caparesponse caparesponse.pm
Log:
- preventing a possible divide by zero
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.215 loncom/homework/caparesponse/caparesponse.pm:1.216
--- loncom/homework/caparesponse/caparesponse.pm:1.215 Tue Jun 5 18:30:05 2007
+++ loncom/homework/caparesponse/caparesponse.pm Wed Jun 6 13:03:54 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.215 2007/06/05 22:30:05 albertel Exp $
+# $Id: caparesponse.pm,v 1.216 2007/06/06 17:03:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -859,7 +859,13 @@
my $bubbles_per_line=int($textwidth/$cell_width);
if ($bubbles_per_line > $number_of_bubbles) {
$bubbles_per_line=$number_of_bubbles;
- }elsif (($bubbles_per_line > $number_of_bubbles/2) && ($number_of_bubbles % 2==0)) {$bubbles_per_line=$number_of_bubbles/2;}
+ } elsif (($bubbles_per_line > $number_of_bubbles/2)
+ && ($number_of_bubbles % 2==0)) {
+ $bubbles_per_line=$number_of_bubbles/2;
+ }
+ if ($bubbles_per_line < 1) {
+ $bubbles_per_line=1;
+ }
my $number_of_tables = int($number_of_bubbles/$bubbles_per_line);
my @table_range = ();
for (my $i=0;$i<$number_of_tables;$i++) {push @table_range,$bubbles_per_line;}