當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。