当前位置: 首页>>代码示例>>Python>>正文


Python DjangoXBlockUserStateClient.get_history方法代码示例

本文整理汇总了Python中courseware.user_state_client.DjangoXBlockUserStateClient.get_history方法的典型用法代码示例。如果您正苦于以下问题:Python DjangoXBlockUserStateClient.get_history方法的具体用法?Python DjangoXBlockUserStateClient.get_history怎么用?Python DjangoXBlockUserStateClient.get_history使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在courseware.user_state_client.DjangoXBlockUserStateClient的用法示例。


在下文中一共展示了DjangoXBlockUserStateClient.get_history方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fix_studentmodules_in_list

# 需要导入模块: from courseware.user_state_client import DjangoXBlockUserStateClient [as 别名]
# 或者: from courseware.user_state_client.DjangoXBlockUserStateClient import get_history [as 别名]
    def fix_studentmodules_in_list(self, save_changes, idlist_path):
        '''Read in the list of StudentModule objects that might need fixing, and then fix each one'''

        # open file and read id values from it:
        for line in open(idlist_path, 'r'):
            student_module_id = line.strip()
            # skip the header, if present:
            if student_module_id == 'id':
                continue
            try:
                module = StudentModule.objects.select_related('student').get(id=student_module_id)
            except StudentModule.DoesNotExist:
                LOG.error(u"Unable to find student module with id = %s: skipping... ", student_module_id)
                continue
            self.remove_studentmodule_input_state(module, save_changes)

            user_state_client = DjangoXBlockUserStateClient()
            hist_modules = user_state_client.get_history(module.student.username, module.module_state_key)

            for hist_module in hist_modules:
                self.remove_studentmodulehistory_input_state(hist_module, save_changes)

            if self.num_visited % 1000 == 0:
                LOG.info(" Progress: updated {0} of {1} student modules".format(self.num_changed, self.num_visited))
                LOG.info(" Progress: updated {0} of {1} student history modules".format(self.num_hist_changed,
                                                                                        self.num_hist_visited))
开发者ID:JudyFox,项目名称:edXMOOC,代码行数:28,代码来源:remove_input_state.py


注:本文中的courseware.user_state_client.DjangoXBlockUserStateClient.get_history方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。