本文整理汇总了Python中oasis.lib.DB.get_q_by_qt_student方法的典型用法代码示例。如果您正苦于以下问题:Python DB.get_q_by_qt_student方法的具体用法?Python DB.get_q_by_qt_student怎么用?Python DB.get_q_by_qt_student使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.DB
的用法示例。
在下文中一共展示了DB.get_q_by_qt_student方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_do_question
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import get_q_by_qt_student [as 别名]
def test_do_question(self):
""" Do a question"""
course_id = Courses.create("TEST102", "Test question logic", 1, 1)
self.assertGreater(course_id, 0)
topic1_id = Topics.create(course_id, "TESTQUESTIONS1", 1, 2)
self.assertGreater(topic1_id, 0)
qt1_id = DB.create_qt(1, "TESTQ9", "Test question 9", 0, 5.0, 1, topic_id=topic1_id)
self.assertIsNotNone(qt1_id)
ver = DB.get_qt_version(qt1_id)
self.assertGreater(ver, 0)
data = "2\n|1\n|2\n"
qvars = [{'A1': "2"}, {'A1': "3"}]
for row in range(0, len(qvars)):
DB.add_qt_variation(qt1_id, row + 1, qvars[row], ver)
DB.create_qt_att(qt1_id, "datfile.dat", "text/plain", data , ver)
DB.create_qt_att(qt1_id, "qtemplate.html", "text/html", "What is <VAL A1>? <ANSWER 1>", ver)
q_id = DB.get_q_by_qt_student(qt1_id, 1)
self.assertFalse(q_id) # Not generated yet
q_id = General.gen_q(qt1_id, 1)
self.assertGreater(q_id, 0)
q_id = DB.get_q_by_qt_student(qt1_id, 1)
self.assertTrue(qt1_id) # Better be there now
DB.update_qt_maxscore(qt1_id, 7.0)
score = DB.get_qt_maxscore(qt1_id)
self.assertEqual(score, 7.0)
DB.set_q_viewtime(q_id)
self.assertIsNotNone(DB.get_q_viewtime(q_id))