Example #1
0
    def on_get(self):

        #if an argument is passed then the test should be comprised of questions of a specific section
        sid = self.get_argument("sid", None)

        #Create new mock test object
        try:
            if sid:
                try:
                    t = PractiseTest.objects(user=str(self.current_user.id),
                                             is_completed=False,
                                             cursor__ne=0).get()
                    self.base_render("test/test.html",
                                     test=t,
                                     timed=False,
                                     existing=True)
                    return
                except DoesNotExist, e:
                    t = PractiseTest()
                    timed = False
                    questions = [
                        question for question in Question.objects(sid=sid)
                    ]  #Get questions related to that section
                    shuffle(questions)
                    questions = questions[:PRACTISE_TEST_SIZE]
            else: