Пример #1
0
class QuizQuestion(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    question_id = db.Column('question_id',
                            db.Integer,
                            db.ForeignKey("question.id"),
                            nullable=False)
    quiz_id = db.Column('quiz_id',
                        db.Integer,
                        db.ForeignKey("quiz.id"),
                        nullable=False)
Пример #2
0
class StudentCourse(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    student_id = db.Column('student_id',
                           db.Integer,
                           db.ForeignKey("student.id"),
                           nullable=False)
    course_id = db.Column('course_id',
                          db.Integer,
                          db.ForeignKey("course.id"),
                          nullable=False)
    # TODO: Make sure only two values (registered/dropped) can be used.
    status = db.Column(db.String(20), nullable=True)
    final_grade = db.Column(db.String(2), nullable=True)
Пример #3
0
class StudentQuizRunAnswers(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    student_quiz_run_question_attempt_id = db.Column('student_quiz_run_question_attempt_id',
                                                     db.Integer, db.ForeignKey("student_quiz_run_question_attempt.id"),
                                                     nullable=False)
    # This answer id is not a foreign key to answer table because we don't know the exact type (MCQ, Fill in the blank
    # etc) of question
    answer_id = db.Column(db.Integer)
Пример #4
0
class Course(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    course_name = db.Column(db.String(80), nullable=False)
    course_section = db.Column(db.String(40), nullable=True)
    professor_id = db.Column('professor_id',
                             db.Integer,
                             db.ForeignKey("professor.id"),
                             nullable=False)
    join_code = db.Column('join_code', db.Integer, unique=True, nullable=False)
Пример #5
0
class MCQAnswers(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    option_text = db.Column(db.String(), nullable=False)
    correct_answer = db.Column(db.Boolean(), nullable=False, default=False)
    # This is 'MCQ id', not the question id from question table
    question_id = db.Column('MCQ_id',
                            db.Integer,
                            db.ForeignKey("MCQ.id"),
                            nullable=False)
Пример #6
0
class MCQ(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    # Making question Id unique ensures one-to-one mapping
    question_id = db.Column('question_id',
                            db.Integer,
                            db.ForeignKey("question.id"),
                            unique=True,
                            nullable=False)
    question_text = db.Column(db.String(), nullable=False)
Пример #7
0
class Quiz(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    quiz_number = db.Column(db.Integer, nullable=False)
    course_id = db.Column('course_id', db.Integer, db.ForeignKey("course.id"), nullable=False)
Пример #8
0
class StudentQuizRunQuestionAttempt(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    student_id = db.Column('student_id', db.Integer, db.ForeignKey("student.id"), nullable=False)
    quiz_run_id = db.Column('quiz_run_id', db.Integer, db.ForeignKey("quiz_run.id"), nullable=False)
    question_id = db.Column('question_id', db.Integer, db.ForeignKey("question.id"), nullable=False)
Пример #9
0
class QuizRun(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    run_number = db.Column(db.Integer, nullable=False)
    quiz_id = db.Column('quiz_id', db.Integer, db.ForeignKey("quiz.id"), nullable=False)
    quiz_run_start_time = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)