本文整理汇总了Python中oasis.lib.DB.get_qt_marker方法的典型用法代码示例。如果您正苦于以下问题:Python DB.get_qt_marker方法的具体用法?Python DB.get_qt_marker怎么用?Python DB.get_qt_marker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.DB
的用法示例。
在下文中一共展示了DB.get_qt_marker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mark_q
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import get_qt_marker [as 别名]
def mark_q(qid, answers):
""" Mark the question according to the answers given in a dictionary and
return the result in a dictionary:
input: {"A1":"0.345", "A2":"fred", "A3":"-26" }
return: {"M1": Mark One, "C1": Comment One, "M2": Mark Two..... }
"""
qtid = DB.get_q_parent(qid)
version = DB.get_q_version(qid)
variation = DB.get_q_variation(qid)
qvars = DB.get_qt_variation(qtid, variation, version)
if not qvars:
qvars = {}
L.warn("markQuestion(%s, %s) unable to retrieve variables." %
(qid, answers))
qvars['OaQID'] = int(qid)
marktype = DB.get_qt_marker(qtid)
if marktype == 1: # standard
marks = mark_q_standard(qvars, answers)
else:
# We want the latest version of the marker, so no version given
markerscript = DB.get_qt_att(qtid, "__marker.py")
if not markerscript:
markerscript = DB.get_qt_att(qtid, "marker.py")
L.info("'marker.py' should now be called '__marker.py' (qtid=%s)" % qtid)
if not markerscript:
L.info("Unable to retrieve marker script for smart marker question (qtid=%s)!" % qtid)
marks = mark_q_standard(qvars, answers)
else:
marks = mark_q_script(qvars, markerscript, answers)
return marks