From 123fe749a667368c55be5a8500c486c43e1f5b6d Mon Sep 17 00:00:00 2001 From: Maximilian Haye Date: Thu, 11 Jul 2024 17:47:55 +0200 Subject: [PATCH] refactor: init cache_control and scoring_method in constructors --- questionpy/_attempt.py | 3 +-- questionpy/_qtype.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/questionpy/_attempt.py b/questionpy/_attempt.py index 617e823..9315c60 100644 --- a/questionpy/_attempt.py +++ b/questionpy/_attempt.py @@ -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", @@ -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] = {} diff --git a/questionpy/_qtype.py b/questionpy/_qtype.py index 2539c1a..51ab95e 100644 --- a/questionpy/_qtype.py +++ b/questionpy/_qtype.py @@ -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]] @@ -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