mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 17:04:33 +12:00
Reuse safe function for fraction
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
1b436a3af8
commit
5c61575c50
|
@ -95,12 +95,7 @@ class EditorView:
|
||||||
|
|
||||||
wordCount = validInt(outlineItem.textCount())
|
wordCount = validInt(outlineItem.textCount())
|
||||||
goal = validInt(outlineItem.goalCount())
|
goal = validInt(outlineItem.goalCount())
|
||||||
progress = 0
|
progress = 100 * safeFraction(wordCount, 0, goal)
|
||||||
|
|
||||||
if goal > wordCount:
|
|
||||||
progress = 100 * wordCount / goal
|
|
||||||
elif goal > 0:
|
|
||||||
progress = 100
|
|
||||||
|
|
||||||
self.outlineStore.set_value(tree_iter, 0, outlineItem.UID.value)
|
self.outlineStore.set_value(tree_iter, 0, outlineItem.UID.value)
|
||||||
self.outlineStore.set_value(tree_iter, 1, validString(outlineItem.title))
|
self.outlineStore.set_value(tree_iter, 1, validString(outlineItem.title))
|
||||||
|
|
Loading…
Reference in a new issue