예제 #1
0
 def max_score(self):
     """
     Return the problem's max score
     """
     from capa.capa_problem import LoncapaProblem, LoncapaSystem
     capa_system = LoncapaSystem(
         ajax_url=None,
         anonymous_student_id=None,
         cache=None,
         can_execute_unsafe_code=None,
         get_python_lib_zip=None,
         DEBUG=None,
         filestore=self.runtime.resources_fs,
         i18n=self.runtime.service(self, "i18n"),
         node_path=None,
         render_template=None,
         seed=None,
         STATIC_URL=None,
         xqueue=None,
         matlab_api_key=None,
     )
     lcp = LoncapaProblem(
         problem_text=self.data,
         id=self.location.html_id(),
         capa_system=capa_system,
         capa_module=self,
         state={},
         seed=1,
         minimal_init=True,
     )
     return lcp.get_max_score()
예제 #2
0
 def max_score(self):
     """
     Return the problem's max score
     """
     from capa.capa_problem import LoncapaProblem, LoncapaSystem
     capa_system = LoncapaSystem(
         ajax_url=None,
         anonymous_student_id=None,
         cache=None,
         can_execute_unsafe_code=None,
         get_python_lib_zip=None,
         DEBUG=None,
         filestore=self.runtime.resources_fs,
         i18n=self.runtime.service(self, "i18n"),
         node_path=None,
         render_template=None,
         seed=None,
         STATIC_URL=None,
         xqueue=None,
         matlab_api_key=None,
     )
     lcp = LoncapaProblem(
         problem_text=self.data,
         id=self.location.html_id(),
         capa_system=capa_system,
         capa_module=self,
         state={},
         seed=1,
         minimal_init=True,
     )
     return lcp.get_max_score()
예제 #3
0
 def max_score(self):
     """
     Return the problem's max score if problem is instantiated successfully, else return max score of 0.
     """
     from capa.capa_problem import LoncapaProblem, LoncapaSystem
     capa_system = LoncapaSystem(
         ajax_url=None,
         anonymous_student_id=None,
         cache=None,
         can_execute_unsafe_code=None,
         get_python_lib_zip=None,
         DEBUG=None,
         filestore=self.runtime.resources_fs,
         i18n=self.runtime.service(self, "i18n"),
         node_path=None,
         render_template=None,
         seed=None,
         STATIC_URL=None,
         xqueue=None,
         matlab_api_key=None,
     )
     try:
         lcp = LoncapaProblem(
             problem_text=self.data,
             id=self.location.html_id(),
             capa_system=capa_system,
             capa_module=self,
             state={},
             seed=1,
             minimal_init=True,
         )
     except responsetypes.LoncapaProblemError:
         log.exception(
             u"LcpFatalError for block {} while getting max score".format(
                 str(self.location)))
         maximum_score = 0
     else:
         maximum_score = lcp.get_max_score()
     return maximum_score