Skip to content

Commit

Permalink
refactor: init cache_control and scoring_method in constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
MHajoha committed Jul 11, 2024
1 parent 2cfda1a commit 123fe74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions questionpy/_attempt.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class Attempt(ABC):
attempt_state_class: ClassVar[type[BaseAttemptState]]
scoring_state_class: ClassVar[type[BaseScoringState]]

cache_control = CacheControl.PRIVATE_CACHE

def __init__(
self,
question: "Question",
Expand All @@ -81,6 +79,7 @@ def __init__(
self.response = response
self.scoring_state = scoring_state

self.cache_control = CacheControl.PRIVATE_CACHE
self.placeholders: dict[str, str] = {}
self.css_files: list[str] = []
self.files: dict[str, AttemptFile] = {}
Expand Down
3 changes: 1 addition & 2 deletions questionpy/_qtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class Question(ABC):
options: FormModel
question_state: BaseQuestionState

scoring_method = ScoringMethod.AUTOMATICALLY_SCORABLE

options_class: ClassVar[type[FormModel]]
question_state_class: ClassVar[type[BaseQuestionState]]
question_state_with_version_class: ClassVar[type[QuestionStateWithVersion]]
Expand All @@ -47,6 +45,7 @@ def __init__(self, qswv: QuestionStateWithVersion) -> None:
self.num_variants = 1
self.score_min: float = 0
self.score_max: float = 1
self.scoring_method = ScoringMethod.AUTOMATICALLY_SCORABLE
self.penalty: float | None = None
self.random_guess_score: float | None = None
self.response_analysis_by_variant = False
Expand Down

0 comments on commit 123fe74

Please sign in to comment.