Skip to content
Snippets Groups Projects
Commit a25f3bd4 authored by Ruben Young On's avatar Ruben Young On
Browse files

MultipleChoiceOption is now a widget

parent 6cde7757
No related branches found
No related tags found
1 merge request!11MultipleChoiceOption is a widget, /exams API call now returns checkbox data
......@@ -98,6 +98,7 @@ class Problem(db.Model):
exam_id = Column(Integer, ForeignKey('exam.id'), nullable=False)
feedback_options = db.relationship('FeedbackOption', backref='problem', order_by='FeedbackOption.id', lazy=True)
solutions = db.relationship('Solution', backref='problem', lazy=True)
mc_options = db.relationship('MultipleChoiceOption', backref='problem', lazy=True)
widget = db.relationship('ProblemWidget', backref='problem', uselist=False, lazy=True)
......@@ -175,6 +176,20 @@ class MultipleChoiceOption(Widget):
}
class MultipleChoiceOption(Widget):
__tablename__ = 'mc_option'
id = Column(Integer, ForeignKey('widget.id'), primary_key=True, autoincrement=True)
label = Column(String, nullable=True)
problem = db.relationship('FeedbackOption', backref='mc_options', lazy='subquery')
feedback_id = Column(Integer, ForeignKey('feedback_option.id'), nullable=True)
__mapper_args__ = {
'polymorphic_identity': 'mcq_widget',
}
class ExamWidget(Widget):
__tablename__ = 'exam_widget'
id = Column(Integer, ForeignKey('widget.id'), primary_key=True, nullable=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment