Esempio n. 1
0
 def POST(self):
     i = web.input()
     firstname = i.firstname
     lastname = i.lastname
     student_id = model.get_student(firstname, lastname)['id']
     session.student_id = student_id
     web.seeother('/dashboard')
Esempio n. 2
0
 def POST(self):
     i = web.input()
     firstname = i.firstname
     lastname = i.lastname
     student_id = model.get_student(firstname, lastname)['id']
     session.student_id = student_id
     web.seeother('/dashboard')
Esempio n. 3
0
	def POST(self):
		i = web.input()
		attempt_id = i.attempt_id
		question_id = i.question_id
		answers = i.answers.strip(',').split(',')
		model.update_answers(web.ctx.session['student_id'], attempt_id, question_id, answers)
		pass
Esempio n. 4
0
 def GET(self):
     i = web.input()
     test_id = i.test_id
     student_id = web.ctx.session['student_id']
     attempt_id = model.start_new_attempt(test_id, student_id)
     raise web.seeother('/test?attempt_id=%s&test_id=%s' %
                        (attempt_id, test_id))
Esempio n. 5
0
    def POST(self):
        data = web.input()
        data.username = session_data['user']['username']

        post_model = Posts.Posts()
        post_model.insert_post(data)
        return "success"
Esempio n. 6
0
	def GET(self):
		i = web.input()
		attempt_id = i.attempt_id
		test_id = i.test_id
		student_id = web.ctx.session['student_id']
		questions = model.get_questions_for_test(test_id, student_id, attempt_id)
		return render.test('Test', attempt_id, questions)
Esempio n. 7
0
 def GET(self):
     i = web.input()
     attempt_id = i.attempt_id
     test_id = i.test_id
     student_id = web.ctx.session['student_id']
     questions = model.get_questions_for_test(test_id, student_id,
                                              attempt_id)
     return render.test('Test', attempt_id, questions)
Esempio n. 8
0
 def POST(self):
     data = web.input()
     data.username = session_data["user"]["username"]
     settings_model = LoginModel.LoginModel()
     if settings_model.update_info(data):
         return "success"
     else:
         return "An error occurred"
Esempio n. 9
0
 def POST(self):
     i = web.input()
     attempt_id = i.attempt_id
     question_id = i.question_id
     answers = i.answers.strip(',').split(',')
     model.update_answers(web.ctx.session['student_id'], attempt_id,
                          question_id, answers)
     pass
Esempio n. 10
0
 def POST(self):
     i = web.input()
     password = i.password
     if password == "HardTaught":
         web.ctx.session["admin_logged_in"] = True
         raise web.seeother("/")
     else:
         return render.admin()
Esempio n. 11
0
 def GET(self):
     i = web.input()
     topic_id = i.topic_id
     if i.get("json"):
         questions = model.get_questions_for_topic(topic_id)
         return json.dumps(questions)
     else:
         topic_name = model.get_topic(topic_id)["name"]
         return render.questions(topic_id, topic_name)
Esempio n. 12
0
    def POST(self):
        data = web.input()
        login = LoginModel.LoginModel()
        isCorrect = login.check_user(data)

        if isCorrect:
            session_data["user"] = isCorrect
            return isCorrect

        return "error"
Esempio n. 13
0
 def GET(self):
     i = web.input()
     question_id = i["question_id"]
     print "question id is", question_id
     question = model.get_question(question_id)
     print "Question is", question
     topic_id = question["topic_id"]
     action = i.action
     if action == "delete":
         model.delete_question(question_id)
     raise web.seeother("questions?topic_id=%(id)s" % {"id": topic_id})
Esempio n. 14
0
 def POST(self):
     i = web.input()
     action = i.action
     if action == "add":
         name = i.name
         model.add_topic(name)
     elif action == "delete":
         id = i.id
         model.delete_topic(id)
     elif action == "rename":
         id = i.id
         name = i.name
         print id, name
         model.rename_topic(id, name)
Esempio n. 15
0
 def POST(self):
     i = web.input(topics=[], final=False)
     action = i.action
     if action == "add":
         topic_ids = [int(x) for x in i.topics]
         question_count = int(i.question_count)
         name = i.name
         final = i.final
         model.add_test(name, topic_ids, question_count, final)
     elif action == "rename":
         name = i.name
         model.rename_test(test_id, name)
     elif action == "delete":
         test_id = i.id
         model.delete_test(test_id)
Esempio n. 16
0
    def POST(self):
        data = web.input()
        reg_model = RegisterModel.RegisterModel()
        reg_model.add_user(data)

        return data.username
Esempio n. 17
0
	def GET(self):
		i = web.input()
		test_id = i.test_id
		student_id = web.ctx.session['student_id']
		attempt_id = model.start_new_attempt(test_id, student_id)
		raise web.seeother('/test?attempt_id=%s&test_id=%s'%(attempt_id, test_id))
Esempio n. 18
0
 def POST(self):
     i = web.input()
     questions = i["file"]
     topic_id = i["topic_id"]
     model.upload_questions(topic_id, questions)
     raise web.seeother("/questions?topic_id=%(id)s" % {"id": topic_id})
Esempio n. 19
0
	def POST(self):
		i = web.input()
		attempt_id = i.attempt_id
		if i.finished == '1':
			model.save_attempt(attempt_id)
		raise web.seeother('../dashboard')
Esempio n. 20
0
 def GET(self):
     i = web.input()
     attempt_id = i.attempt_id
     test_id = i.test_id
     raise web.seeother('/test?attempt_id=%s&test_id=%s' %
                        (attempt_id, test_id))
Esempio n. 21
0
	def GET(self):
		i = web.input()
		attempt_id = i.attempt_id
		test_id = i.test_id
		raise web.seeother('/test?attempt_id=%s&test_id=%s'%(attempt_id, test_id))
Esempio n. 22
0
 def POST(self):
     i = web.input()
     attempt_id = i.attempt_id
     if i.finished == '1':
         model.save_attempt(attempt_id)
     raise web.seeother('../dashboard')