alter_data.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:micromasters 作者: mitodl 项目源码 文件源码
def get_past_ungraded_course_run(user=None, course=None, now=None):
    """Loop through past course runs and find one without grade data"""
    past_runs = CourseRun.objects.filter(
        course=course,
        end_date__lt=now,
    ).exclude(end_date=None).order_by('-end_date').all()
    for past_run in past_runs:
        if not (CachedCurrentGradeHandler(user).exists(past_run) or
                FinalGrade.objects.filter(user=user, course_run=past_run).exists()):
            return past_run
    raise CommandError("Can't find past run that isn't already passed/failed for Course '{}'".format(course.title))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号