rounding of percents
Hi!
Find attached a patch for the stattrans.pl which rounds the percents
that we are using correctly. It's not much but it should work.
I did it mainly for it seems awkward for me to see lines like this:
Language Translations Up to date Outdated Not translated
German (de) 397 (41%) 395 (40%) 2 (0%) 570 (58%)
In here you see all the things that are bugging me a little bit:
translations% should be == up2date% plus outdated%
translations% plus !translated% == 100%
Which isn't, and I think it's because we truncate the komma part
instead of rounding it. The current values are quite irritating.
Thanks,
Alfie [apply it, if you think it's useful]
--
You never learn anything | /"""""\ ,'~~.
by doing it right. | / chaos \ alfie.ist.org |o ?~\
-- unknown | \inside!/ alfie@ist.org /_ ~<\
| \_____/ \__,~ \>
Index: stattrans.pl
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.23
diff -u -r1.23 stattrans.pl
--- stattrans.pl 2001/07/22 17:07:42 1.23
+++ stattrans.pl 2001/08/29 09:14:56
@@ -282,10 +282,10 @@
$wml{$lang} = $translated{$lang};
$translated{$lang} = $translated{$lang} - $outdated{$lang};
- $percent_a{$lang} = $wml{$lang}/$wml{english} * 100;
- $percent_t{$lang} = $translated{$lang}/$wml{english} * 100;
- $percent_o{$lang} = $outdated{$lang}/$wml{english} * 100;
- $percent_u{$lang} = $untranslated{$lang}/$wml{english} * 100;
+ $percent_a{$lang} = $wml{$lang}/$wml{english} * 100 + .5;
+ $percent_t{$lang} = $translated{$lang}/$wml{english} * 100 + .5;
+ $percent_o{$lang} = $outdated{$lang}/$wml{english} * 100 + .5;
+ $percent_u{$lang} = $untranslated{$lang}/$wml{english} * 100 + .5;
if (open (HTML, ">$config{'htmldir'}/$l.html")) {
printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=#ffffff>\n", $config{'title'}, ucfirst $lang;
Reply to: