--- perl/kanzan/kanzan.cgi 2002/09/04 08:57:28 1.3 +++ perl/kanzan/kanzan.cgi 2002/09/04 09:02:38 1.4 @@ -68,7 +68,7 @@ $kanzaned1{_ALL} += $kanzaned1{$subject}; $$full1{_ALL} += $$full1{$subject}; } - $kanzaned1{_PERCENT} = 100*$kanzaned1{_ALL}/$$full1{_ALL}; + $kanzaned1{_PERCENT} = $$full1{_ALL}==0?0:100*$kanzaned1{_ALL}/$$full1{_ALL}; $$full2{_ALL} = 0; for my $subject (keys %$full2) { next if $subject =~ /^_/; @@ -76,12 +76,14 @@ $kanzaned2{_ALL} += $kanzaned2{$subject}; $$full2{_ALL} += $$full2{$subject}; } - $kanzaned2{_PERCENT} = 100*$kanzaned2{_ALL}/$$full2{_ALL}; + $kanzaned2{_PERCENT} = $$full2{_ALL}==0?0:100*$kanzaned2{_ALL}/$$full2{_ALL}; my ($percent, $object_percent); - $percent = 100*($kanzaned1{_ALL}+$kanzaned2{_ALL}) + $percent = ($$full1{_ALL}+$$full2{_ALL})==0?0: + 100*($kanzaned1{_ALL}+$kanzaned2{_ALL}) /($$full1{_ALL}+$$full2{_ALL}); - $object_percent = ($$point1{_OBJECT}*$$full1{_ALL} + $object_percent = ($$full1{_ALL}+$$full2{_ALL})==0?0: + ($$point1{_OBJECT}*$$full1{_ALL} +$$point2{_OBJECT}*$$full2{_ALL}) /($$full1{_ALL}+$$full2{_ALL}); ($percent, $object_percent, \%kanzaned1, \%kanzaned2); @@ -139,7 +141,7 @@