本文整理汇总了Python中oasis.lib.Courses.get_exams方法的典型用法代码示例。如果您正苦于以下问题:Python Courses.get_exams方法的具体用法?Python Courses.get_exams怎么用?Python Courses.get_exams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.Courses
的用法示例。
在下文中一共展示了Courses.get_exams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cadmin_top
# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_exams [as 别名]
def cadmin_top(course_id):
""" Present top level course admin page """
course = Courses2.get_course(course_id)
if not course:
abort(404)
user_id = session['user_id']
is_sysadmin = check_perm(user_id, -1, 'sysadmin')
topics = Courses2.get_topics_list(course_id)
exams = [Exams.get_exam_struct(exam_id, course_id)
for exam_id in Courses.get_exams(course_id, prev_years=False)]
exams.sort(key=lambda y: y['start_epoch'], reverse=True)
groups = Courses.get_groups(course_id)
choosegroups = [group
for group in Groups.all_groups()
if group.id not in groups]
return render_template(
"courseadmin_top.html",
course=course,
topics=topics,
exams=exams,
choosegroups=choosegroups,
groups=groups,
is_sysadmin=is_sysadmin
)
示例2: get_exam_list_sorted
# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_exams [as 别名]
def get_exam_list_sorted(user_id, prev_years=False):
""" Return a list of exams for the given user. """
courses = Courses.get_all()
exams = []
for cid in courses:
try:
exams += [Exams.get_exam_struct(e, user_id)
for e in Courses.get_exams(cid, prev_years=prev_years)]
except KeyError, err:
L.error("Failed fetching exam list for user %s: %s" %
(user_id, err))