def _schema(cls): return [ Column('users', ForeignKey('users')), Column(cls._fk_col, ForeignKey(cls._fk_col)), Column('question', ForeignKey('question')), Column('answer', CodeString(5000)), Column('comment', CodeString(1000), required=False, default=''), Column('score', Integer(), default=-1), ]
class ExerciseAnsware(Table): _name = 'exercise_answare' _schema = [ Column('exercise', ForeignKey('exercise')), Column('users', ForeignKey('users')), Column('answare', CodeString(5000)), Column('first_answare', CodeString(5000), default=""), Column('status', String(20)), ]
class Exercise(Table): _name = 'exercise' _schema = [ Column('id', Integer, primary_key=True), Column('title', String(255)), Column('task', CodeString(10000)), Column('possible_answare', CodeString(1000), required=False), Column('author', ForeignKey('users'), default=1), Column('time_created', DateTime(), default=datetime.utcnow), Column('lesson', ForeignKey('lesson')), ]
class LiveQuizAnsware(Table): _name = 'live_quiz_answare' _schema = [ Column('live_quiz', ForeignKey('live_quiz')), Column('question', ForeignKey('question')), Column('answare', CodeString(5000)), ]
class QuestionAnsware(Table): _name = 'question_answare' _schema = [ Column('users', ForeignKey('users')), Column('question', ForeignKey('question')), Column('answare', CodeString(5000)), ] _unique = ['users', 'question']
class ExerciseAnsware(Table): _name = 'lesson_status' _schema = [ Column('exercise', ForeignKey('exercise')), Column('users', ForeignKey('users')), Column('answare', CodeString(5000)), Column('status', String(20)), ]
def _schema(cls): return [ Column('users', ForeignKey('users')), Column(cls._fk_col, ForeignKey(cls._fk_col)), Column('progress', Integer(), default=0), Column('score', Integer(), default=-1), Column('comment', CodeString(1000), required=False, default=''), Column('status', String(50), default='NotStarted'), ]
class LessonFeedbackAnswer(Table): _name = 'lesson_feedback_answer' _schema = [ Column('id', Integer, primary_key=True), Column('author', ForeignKey('users')), Column('answers', CodeString(10000)), Column('question', ForeignKey('lesson_feedback_question')), Column('lesson', ForeignKey('lesson')) ]
class Question(Table): _name = 'question' _schema = [ Column('id', Integer, primary_key=True), Column('question', String(1000)), Column('answares', CodeString(2000), default=''), Column('possible_answare', String(1000), default=''), Column('qtype', String(50), default='plain'), Column('img', String(255), required=False, default=''), Column('users', ForeignKey('users'), default=DEFAULT_USER), Column('time_created', DateTime(), default=datetime.utcnow), ]
class LessonFeedbackQuestion(Table): _name = 'lesson_feedback_question' _schema = [ Column('id', Integer, primary_key=True), Column('author', ForeignKey('users'), default=DEFAULT_USER), Column('type', String(50)), Column('description', String(5000)), Column('answers', CodeString(10000)) ] @classmethod async def get_by_lesson_id(cls, lid): return await cls.get_by_join("lesson_feedback_meta", lesson=lid, id=StringLiteral("question"))