@@ -626,21 +626,6 @@ def test_instructor_practice_admin(test_client, runestone_db_tools, test_user):
626626
627627 # Test instructor adding a subchapter to the practice tool for students.
628628
629- f = open ("demofile2.txt" , "w" )
630-
631- course_1 = db (db .courses .id > 0 ) \
632- .select ().first ()
633- f .write ("\n \n \n ****course_1: " + str (course_1 ))
634- f .write ("\n \n \n ****course_4.course_name: " + course_4 .course_name )
635- chapters = db ((db .chapters .course_id > 0 )) \
636- .select ()
637- for chapter in chapters :
638- f .write ("chapter: " + str (chapter ) + "\n " )
639- subchapters = db ((db .sub_chapters .chapter_id == chapter .id )) \
640- .select ()
641- for subchapter in subchapters :
642- f .write ("subchapter: " + str (subchapter ) + "\n " )
643-
644629 # I need to call set_tz_offset to set timezoneoffset in the session.
645630 test_client .post ('ajax/set_tz_offset' ,
646631 data = { 'timezoneoffset' : 0 })
@@ -649,19 +634,7 @@ def test_instructor_practice_admin(test_client, runestone_db_tools, test_user):
649634 test_client .post ('admin/add_practice_items' ,
650635 data = { 'data' : '["Test chapter 1/Subchapter B"]' })
651636
652- import pdb ; pdb .set_trace ()
653-
654637
655- user_topic_practices = db ((db .user_topic_practice .id > 0 )) \
656- .select ()
657- f .write ("len(user_topic_practices): " + str (len (user_topic_practices )) + "\n " )
658- for user_topic_practice in user_topic_practices :
659- f .write ("user_topic_practice: " + str (user_topic_practice ) + "\n " )
660- questions = db ((db .questions .id > 0 )) \
661- .select ()
662- f .write ("len(questions): " + str (len (questions )) + "\n " )
663- # for question in questions:
664- # f.write("question: " + str(question) + "\n")
665638 practice_settings_1 = db (
666639 (db .user_topic_practice .user_id == test_student_1 .user_id ) &
667640 (db .user_topic_practice .course_name == course_4 .course_name ) &
@@ -670,10 +643,31 @@ def test_instructor_practice_admin(test_client, runestone_db_tools, test_user):
670643 ).select ().first ()
671644 assert practice_settings_1
672645
673- f . close ()
646+ # Testing whether a student can answer a practice question.
674647 # test_client.logout()
675648 # test_student_1.login()
676649
650+ # ts = datetime.datetime.utcnow()
651+ # ts -= datetime.timedelta(microseconds=ts.microsecond)
652+
653+ # test_client.post('ajax/hsblog',
654+ # data = {'event': 'mChoice',
655+ # 'act': 'answer:1:correct',
656+ # 'answer': 1,
657+ # 'correct': 'T',
658+ # 'div_id': 'subc_b_1',
659+ # 'course': course_4.course_name,
660+ # 'timezoneoffset': 0})
661+
662+ # mchoice_answers_1 = db(
663+ # (db.mchoice_answers.sid == test_student_1.user_id) &
664+ # (db.mchoice_answers.course_name == course_4.course_name) &
665+ # (db.mchoice_answers.correct == "test_chapter_1") &
666+ # (db.mchoice_answers.sub_chapter_label == "subchapter_b")
667+ # ).select().first()
668+ # assert practice_settings_1
669+ # db.mchoice_answers.insert(sid=sid,timestamp=ts, div_id=div_id, answer=answer, correct=correct, course_name=course)
670+
677671
678672def test_deleteaccount (test_client , runestone_db_tools , test_user ):
679673 course_3 = runestone_db_tools .create_course ('test_course_3' )
0 commit comments