[gimp-help] tools: don't convert percentage to int before rounding
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-help] tools: don't convert percentage to int before rounding
- Date: Sun, 13 Mar 2022 23:11:45 +0000 (UTC)
commit 688f7040c2a55985a90655e326079fa682011e0e
Author: Jacob Boerema <jgboerema gmail com>
Date: Sun Feb 27 14:46:25 2022 -0500
tools: don't convert percentage to int before rounding
Also show the percentage with a little more detail in console
(cherry picked from commit 14ad188ab998ba2aa24f3eedda37bbfaa8ca0c76)
tools/translated_percentage.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tools/translated_percentage.py b/tools/translated_percentage.py
index 7428875da..3dba70606 100755
--- a/tools/translated_percentage.py
+++ b/tools/translated_percentage.py
@@ -84,7 +84,7 @@ class GetFolderStats(object):
pct = 0
if self.total_messages > 0:
pct = self.translated_messages / self.total_messages * 100
- pct_round = round(pct)
+ pct_round = round(pct,1)
if pct_round == 100 and self.translated_messages < self.total_messages:
pct_round = 99
print(f"{self.lang_dir} - Total files: {self.total_files}, messages: {self.total_messages},
{pct_round}% done")
@@ -114,7 +114,7 @@ class WriteStats(object):
langcode = stats.lang_dir
percent = 0
if stats.total_messages > 0:
- percent = int(stats.translated_messages / stats.total_messages * 100)
+ percent = stats.translated_messages / stats.total_messages * 100
pct_round = round(percent)
# Don't show it as 100% done until all messages are translated.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]