stattrans.pl
Hi!
I object to the last changes to the stattrans.pl script :) I am going
to submit the following diff for the file:
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.29
diff -u -r1.29 stattrans.pl
--- stattrans.pl 2001/09/12 19:14:15 1.29
+++ stattrans.pl 2001/09/13 14:32:42
@@ -262,9 +262,9 @@
$wml{$lang} = $translated{$lang};
$translated{$lang} = $translated{$lang} - $outdated{$lang};
- $percent_a{$lang} = int ($wml{$lang}/$nfiles * 100);
- $percent_t{$lang} = int ($translated{$lang}/$nfiles * 100);
- $percent_o{$lang} = int ($outdated{$lang}/$nfiles * 100);
+ $percent_a{$lang} = int ($wml{$lang}/$nfiles * 100 + .5);
+ $percent_t{$lang} = int ($translated{$lang}/$nfiles * 100 + .5);
+ $percent_o{$lang} = 100 - $percent_t{$lang};
$percent_u{$lang} = 100 - $percent_a{$lang};
if (open (HTML, ">$config{'htmldir'}/$l.html")) {
===================================================================
There is no need at all to calculate percent_o, it's just the inverse
to percent_t, like percent_u is for percent_a. If you don't believe
please think of it. $outdated == $nfiles - $translated, and therefore
it yields the same value. So if we don't calculate percent_u we should
stop calculating percent_o too, if it's for performance-reasons.
Also, if we are going to int() the value of the percentage we should
round it properly, therefore the .5 - which I earlier sugguested. If
the int is removed the .5 should be removed in this place too, but as
long as it's int() the .5 should stay there.
Thanks,
Alfie
--
You never learn anything | /"""""\ ,'~~.
by doing it right. | / chaos \ alfie.ist.org |o ?~\
-- unknown | \inside!/ alfie@ist.org /_ ~<\
| \_____/ \__,~ \>
Reply to: