コード例 #1
0
    def delete(self, activity_type, activity_id):
        if activity_type == constants.ACTIVITY_TYPE_EXPLORATION:
            learner_progress_services.remove_exp_from_incomplete_list(
                self.user_id, activity_id)
        elif activity_type == constants.ACTIVITY_TYPE_COLLECTION:
            learner_progress_services.remove_collection_from_incomplete_list(
                self.user_id, activity_id)

        self.render_json(self.values)
コード例 #2
0
ファイル: reader.py プロジェクト: arnab20ghosh/oppia
    def delete(self, activity_type, activity_id):
        """Removes exploration or collection from incomplete list.

        Args:
            activity_type: str. The activity type. Currently, it can take values
                "exploration" or "collection".
            activity_id: str. The ID of the activity to be deleted.
        """
        if activity_type == constants.ACTIVITY_TYPE_EXPLORATION:
            learner_progress_services.remove_exp_from_incomplete_list(
                self.user_id, activity_id)
        elif activity_type == constants.ACTIVITY_TYPE_COLLECTION:
            learner_progress_services.remove_collection_from_incomplete_list(
                self.user_id, activity_id)

        self.render_json(self.values)
コード例 #3
0
    def test_remove_exp_from_incomplete_list(self):
        self.assertEqual(self._get_all_incomplete_exp_ids(self.user_id), [])

        state_name = 'state name'
        version = 1

        # Add incomplete explorations.
        learner_progress_services.mark_exploration_as_incomplete(
            self.user_id, self.EXP_ID_0, state_name, version)
        learner_progress_services.mark_exploration_as_incomplete(
            self.user_id, self.EXP_ID_1, state_name, version)
        self.assertEqual(self._get_all_incomplete_exp_ids(self.user_id),
                         [self.EXP_ID_0, self.EXP_ID_1])

        # Removing an exploration.
        learner_progress_services.remove_exp_from_incomplete_list(
            self.user_id, self.EXP_ID_0)
        self.assertEqual(self._get_all_incomplete_exp_ids(self.user_id),
                         [self.EXP_ID_1])

        # Removing the same exploration again has no effect.
        learner_progress_services.remove_exp_from_incomplete_list(
            self.user_id, self.EXP_ID_0)
        self.assertEqual(self._get_all_incomplete_exp_ids(self.user_id),
                         [self.EXP_ID_1])

        # Removing the second exploration.
        learner_progress_services.remove_exp_from_incomplete_list(
            self.user_id, self.EXP_ID_1)
        self.assertEqual(self._get_all_incomplete_exp_ids(self.user_id), [])
コード例 #4
0
ファイル: reader.py プロジェクト: rohitkatlaa/oppia
    def delete(self, activity_type, activity_id):
        """Removes exploration, collection, story or topic from incomplete
            list.

        Args:
            activity_type: str. The activity type. Currently, it can take values
                "exploration", "collection", "story" or "topic".
            activity_id: str. The ID of the activity to be deleted.
        """
        if activity_type == constants.ACTIVITY_TYPE_EXPLORATION:
            learner_progress_services.remove_exp_from_incomplete_list(
                self.user_id, activity_id)
        elif activity_type == constants.ACTIVITY_TYPE_COLLECTION:
            learner_progress_services.remove_collection_from_incomplete_list(
                self.user_id, activity_id)
        elif activity_type == constants.ACTIVITY_TYPE_STORY:
            learner_progress_services.remove_story_from_incomplete_list(
                self.user_id, activity_id)
        elif activity_type == constants.ACTIVITY_TYPE_LEARN_TOPIC:
            learner_progress_services.remove_topic_from_partially_learnt_list(
                self.user_id, activity_id)

        self.render_json(self.values)
コード例 #5
0
ファイル: reader.py プロジェクト: gvirav/oppia
 def post(self):
     """Handles POST requests."""
     exploration_id = self.payload.get('exploration_id')
     learner_progress_services.remove_exp_from_incomplete_list(
         self.user_id, exploration_id)
     self.render_json(self.values)