本文整理汇总了Python中oasis.lib.DB.get_exam_q_by_qt_student方法的典型用法代码示例。如果您正苦于以下问题:Python DB.get_exam_q_by_qt_student方法的具体用法?Python DB.get_exam_q_by_qt_student怎么用?Python DB.get_exam_q_by_qt_student使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.DB
的用法示例。
在下文中一共展示了DB.get_exam_q_by_qt_student方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remark_exam
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import get_exam_q_by_qt_student [as 别名]
def remark_exam(exam, student):
"""Re-mark the exam using the latest marking. """
qtemplates = Exams.get_qts(exam)
examtotal = 0.0
end = Exams.get_mark_time(exam, student)
for qtemplate in qtemplates:
question = DB.get_exam_q_by_qt_student(exam, qtemplate, student)
answers = DB.get_q_guesses_before_time(question, end)
try:
marks = mark_q(question, answers)
except OaMarkerError:
L.warn("Marker Error, question %d while re-marking exam %s for student %s!" % (question, exam, student))
marks = {}
parts = [int(var[1:]) for var in marks.keys() if re.search("^A([0-9]+)$", var) > 0]
parts.sort()
total = 0.0
for part in parts:
if marks['C%d' % part] == 'Correct':
marks['C%d' % part] = "<b><font color='darkgreen'>Correct</font></b>"
try:
mark = float(marks['M%d' % part])
except (ValueError, TypeError, KeyError):
mark = 0
total += mark
DB.update_q_score(question, total)
# OaDB.setQuestionStatus(question, 3) # 3 = marked
examtotal += total
Exams.save_score(exam, student, examtotal)
return examtotal