diff --git a/src/android_app_plugin/kolibri_plugin.py b/src/android_app_plugin/kolibri_plugin.py index 7a136f5..4439009 100644 --- a/src/android_app_plugin/kolibri_plugin.py +++ b/src/android_app_plugin/kolibri_plugin.py @@ -9,6 +9,7 @@ Locale = autoclass("java.util.Locale") Task = autoclass("org.learningequality.Task") +PROGRESS_LIMIT = 10000 logger = logging.getLogger(__name__) @@ -68,6 +69,13 @@ def update(self, job, orm_job, state=None, **kwargs): else: progress = -1 total_progress = -1 + + # avoid passing integers that are too large + # PROGRESS_LIMIT gives sufficient precision for a % progress calculation + if total_progress > PROGRESS_LIMIT: + progress = progress // total_progress * PROGRESS_LIMIT + total_progress = PROGRESS_LIMIT + Task.updateProgress( orm_job.worker_extra, status.title,