Fix issue with fractions

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2023-02-03 15:30:02 +01:00
parent 038e101386
commit 25e0d700a4
No known key found for this signature in database
GPG key ID: D850A5F772E880F9

View file

@ -3,6 +3,7 @@
import re
import time
import traceback
from manuskript.util.counter import CounterKind, CharCounter, WordCounter, PageCounter
@ -65,7 +66,7 @@ def countText(text: str, kind: CounterKind = CounterKind.WORDS):
def safeFraction(value, low, high) -> float:
if value < low:
if value < low or high <= low:
return 0.0
elif value > high:
return 1.0