本文整理汇总了Python中models.models.Student.kind方法的典型用法代码示例。如果您正苦于以下问题:Python Student.kind方法的具体用法?Python Student.kind怎么用?Python Student.kind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.models.Student
的用法示例。
在下文中一共展示了Student.kind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish
# 需要导入模块: from models.models import Student [as 别名]
# 或者: from models.models.Student import kind [as 别名]
def finish(self):
leader_badge_slugs = ('expert.leader', 'expert.expertise.leader')
leader_badges = dict((k, Badge.get_by_key_name(k)) for k in leader_badge_slugs)
for group_id, (emails, count) in self.best_by_group.iteritems():
self.log.append('Considering group %s, best score is %d' % (
str(group_id), count))
if count < 1:
self.log.append('... Best score is too low, skipping.')
continue
for email in emails:
report = ExpertBadgeReport.on(
db.Key.from_path(Student.kind(), email),
course=self.course,
force_re_run=self.re_run)
base_badge_version = choose_expert_badge_version(report.completion())
if not base_badge_version:
raise AssertionError('They should have passed, wat?')
leader_badge_slug = base_badge_version + '.leader'
if self.really:
leader_badge = leader_badges[leader_badge_slug]
b = Badge.issue(leader_badge,
db.Key.from_path(Student.kind(), email), put=False)
b.evidence = self.host_url + '/badges/expert_evidence?id=%d' % report.key().id()
b.put()
self.log.append('... ISSUED %s to %s, id=%d' % (
leader_badge_slug, email, b.key().id()))
else:
self.log.append('... WOULD ISSUE %s to %s' % (
leader_badge_slug, email))
self._batch_write()