Exemplo n.º 1
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        # Topic cannot be None as an exception will be thrown from its decorator
        # if so.
        topic = topic_services.get_topic_by_name(topic_name)

        interaction_ids = feconf.ALLOWED_QUESTION_INTERACTION_IDS

        interaction_dependency_ids = (
            interaction_registry.Registry.get_deduplicated_dependency_ids(
                interaction_ids))
        dependencies_html, additional_angular_modules = (
            dependency_registry.Registry.get_deps_html_and_angular_modules(
                interaction_dependency_ids))

        interaction_templates = (
            interaction_registry.Registry.get_interaction_html(
                interaction_ids))

        self.values.update({
            'DEFAULT_OBJECT_VALUES': obj_services.get_default_object_values(),
            'additional_angular_modules': additional_angular_modules,
            'INTERACTION_SPECS': interaction_registry.Registry.get_all_specs(),
            'interaction_templates': jinja2.utils.Markup(
                interaction_templates),
            'dependencies_html': jinja2.utils.Markup(dependencies_html),
            'topic_name': topic.name,
        })
        self.render_template('dist/practice-session-page.mainpage.html')
Exemplo n.º 2
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURES:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)

        canonical_story_summaries = [
            story_services.get_story_summary_by_id(
                canonical_story_id) for canonical_story_id
            in topic.canonical_story_ids]

        additional_story_summaries = [
            story_services.get_story_summary_by_id(
                additional_story_id) for additional_story_id
            in topic.additional_story_ids]

        canonical_story_dicts = [
            summary.to_human_readable_dict() for summary
            in canonical_story_summaries]

        additional_story_dicts = [
            summary.to_human_readable_dict() for summary
            in additional_story_summaries]

        self.values.update({
            'topic_name': topic.name,
            'canonical_story_dicts': canonical_story_dicts,
            'additional_story_dicts': additional_story_dicts
        })
        self.render_json(self.values)
Exemplo n.º 3
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)

        if topic is None:
            raise self.PageNotFoundException(
                Exception('The topic with the given name doesn\'t exist.'))

        interaction_ids = feconf.ALLOWED_QUESTION_INTERACTION_IDS

        interaction_dependency_ids = (
            interaction_registry.Registry.get_deduplicated_dependency_ids(
                interaction_ids))
        dependencies_html, additional_angular_modules = (
            dependency_registry.Registry.get_deps_html_and_angular_modules(
                interaction_dependency_ids))

        interaction_templates = (
            interaction_registry.Registry.get_interaction_html(
                interaction_ids))

        self.values.update({
            'DEFAULT_OBJECT_VALUES': obj_services.get_default_object_values(),
            'additional_angular_modules': additional_angular_modules,
            'INTERACTION_SPECS': interaction_registry.Registry.get_all_specs(),
            'interaction_templates': jinja2.utils.Markup(
                interaction_templates),
            'dependencies_html': jinja2.utils.Markup(dependencies_html),
            'topic_name': topic.name,
        })
        self.render_template('dist/practice_session.html')
Exemplo n.º 4
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURES:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)

        self.values.update({'topic_name': topic.name})
        self.render_template('/pages/topic_viewer/topic_viewer.html')
Exemplo n.º 5
0
    def get(self, topic_name):

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        # Topic cannot be None as an exception will be thrown from its decorator
        # if so.
        topic = topic_services.get_topic_by_name(topic_name)
        try:
            skills = skill_services.get_multi_skills(topic.get_all_skill_ids())
        except Exception, e:
            raise self.PageNotFoundException(e)
Exemplo n.º 6
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)

        if topic is None:
            raise self.PageNotFoundException(
                Exception('The topic with the given name doesn\'t exist.'))

        self.render_template('/pages/practice_session/practice_session.html')
Exemplo n.º 7
0
    def get(self, topic_name):

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        # Topic cannot be None as an exception will be thrown from its decorator
        # if so.
        topic = topic_services.get_topic_by_name(topic_name)
        skills_of_topic = topic.get_all_skill_ids()

        topic_name = topic.name

        self.values.update({
            'topic_name': topic.name,
            'skill_list': skills_of_topic
        })
        self.render_json(self.values)
Exemplo n.º 8
0
    def get(self, topic_name):

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)
        skills_of_topic = topic.get_all_skill_ids()

        if topic is None:
            raise self.PageNotFoundException(
                Exception('The topic with the given name doesn\'t exist.'))
        topic_name = topic.name

        self.values.update({
            'topic_name': topic.name,
            'skill_list': skills_of_topic
        })
        self.render_json(self.values)
Exemplo n.º 9
0
    def get(self, topic_name):
        """Handles GET requests."""

        if not constants.ENABLE_NEW_STRUCTURE_PLAYERS:
            raise self.PageNotFoundException

        topic = topic_services.get_topic_by_name(topic_name)
        canonical_story_ids = topic.get_canonical_story_ids()
        additional_story_ids = topic.get_additional_story_ids()
        canonical_story_summaries = [
            story_fetchers.get_story_summary_by_id(canonical_story_id)
            for canonical_story_id in canonical_story_ids
        ]

        additional_story_summaries = [
            story_fetchers.get_story_summary_by_id(additional_story_id)
            for additional_story_id in additional_story_ids
        ]

        canonical_story_dicts = [
            summary.to_human_readable_dict()
            for summary in canonical_story_summaries
        ]

        additional_story_dicts = [
            summary.to_human_readable_dict()
            for summary in additional_story_summaries
        ]

        uncategorized_skill_ids = topic.get_all_uncategorized_skill_ids()
        subtopics = topic.get_all_subtopics()

        self.values.update({
            'topic_id': topic.id,
            'topic_name': topic.name,
            'canonical_story_dicts': canonical_story_dicts,
            'additional_story_dicts': additional_story_dicts,
            'uncategorized_skill_ids': uncategorized_skill_ids,
            'subtopics': subtopics
        })
        self.render_json(self.values)