Reuse safe function for fraction

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2022-11-20 01:07:15 +01:00
parent 1b436a3af8
commit 5c61575c50
No known key found for this signature in database
GPG key ID: D850A5F772E880F9

View file

@ -95,12 +95,7 @@ class EditorView:
wordCount = validInt(outlineItem.textCount())
goal = validInt(outlineItem.goalCount())
progress = 0
if goal > wordCount:
progress = 100 * wordCount / goal
elif goal > 0:
progress = 100
progress = 100 * safeFraction(wordCount, 0, goal)
self.outlineStore.set_value(tree_iter, 0, outlineItem.UID.value)
self.outlineStore.set_value(tree_iter, 1, validString(outlineItem.title))