diff --git a/kolibri_explore_plugin/collectionviews.py b/kolibri_explore_plugin/collectionviews.py index c660e3886..d54da4dba 100644 --- a/kolibri_explore_plugin/collectionviews.py +++ b/kolibri_explore_plugin/collectionviews.py @@ -50,8 +50,7 @@ PROGRESS_STEPS = { "importing": 0.1, - "downloading": 0.8, - "tagging": 0.9, + "downloading": 0.9, "completed": 1, } @@ -247,8 +246,8 @@ class DownloadStage(IntEnum): IMPORTING_CHANNELS = auto() IMPORTING_CONTENT = auto() APPLYING_EXTERNAL_TAGS = auto() - IMPORTING_EXTRA_CHANNELS = auto() FOREGROUND_COMPLETED = auto() + IMPORTING_EXTRA_CHANNELS = auto() IMPORTING_ALL_THUMBNAILS = auto() COMPLETED = auto() @@ -444,7 +443,7 @@ def get_status(self): progress = ( PROGRESS_STEPS["downloading"] + ( - PROGRESS_STEPS["tagging"] + PROGRESS_STEPS["completed"] - PROGRESS_STEPS["downloading"] ) * current_task_number @@ -453,17 +452,6 @@ def get_status(self): else: progress = PROGRESS_STEPS["downloading"] - elif self._stage == DownloadStage.IMPORTING_EXTRA_CHANNELS: - if total_tasks_number > 0: - progress = ( - PROGRESS_STEPS["tagging"] - + (PROGRESS_STEPS["completed"] - PROGRESS_STEPS["tagging"]) - * current_task_number - / total_tasks_number - ) - else: - progress = PROGRESS_STEPS["tagging"] - elif self._stage >= DownloadStage.FOREGROUND_COMPLETED: progress = PROGRESS_STEPS["completed"] @@ -520,7 +508,11 @@ def _set_next_stage(self, user): elif self._stage == DownloadStage.APPLYING_EXTERNAL_TAGS: tasks = self._content_manifest.get_applyexternaltags_tasks() elif self._stage == DownloadStage.IMPORTING_EXTRA_CHANNELS: - tasks = self._content_manifest.get_extra_channelimport_tasks() + # Download the remaining channel metadata in the background. + for ( + task + ) in self._content_manifest.get_extra_channelimport_tasks(): + self._enqueue_background_task(user, task) elif self._stage == DownloadStage.IMPORTING_ALL_THUMBNAILS: # Download the remaining content thumbnails in the background. for (