Skip to content

Commit

Permalink
fix: fix submitting question answers
Browse files Browse the repository at this point in the history
  • Loading branch information
AmooHashem committed Dec 28, 2024
1 parent ef73f34 commit f2093aa
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions apps/fsm/models/question_widgets.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.validators import MinValueValidator
from django.db import models

from apps.fsm.models.response import BigAnswer, MultiChoiceAnswer, SmallAnswer, UploadFileAnswer
from apps.fsm.models.base import Widget, clone_widget
from apps.fsm.models.fsm import State
from apps.fsm.models.team import Team

PROBLEM_ANSWER_MAPPING = {
'SmallAnswerProblem': SmallAnswer,
Expand Down Expand Up @@ -37,21 +35,42 @@ def unfinalize_user_previous_answers(self, user):
def __str__(self):
return f'<{self.id}-{self.widget_type}>:{self.name}'

@property
def correct_answer(self):
raise NotImplementedError(
f"The 'correct_answer' property must be implemented in the subclass of {self.__class__.__name__}."
)


class SmallAnswerProblem(Problem):
def clone(self, paper):
return clone_widget(self, paper)

@property
def correct_answer(self):
# todo: not implemented
return None


class BigAnswerProblem(Problem):
def clone(self, paper):
return clone_widget(self, paper)

@property
def correct_answer(self):
# todo: not implemented
return None


class UploadFileProblem(Problem):
def clone(self, paper):
return clone_widget(self, paper)

@property
def correct_answer(self):
# todo: not implemented
return None


class MultiChoiceProblem(Problem):
min_selections = models.IntegerField(
Expand Down

0 comments on commit f2093aa

Please sign in to comment.