diff --git a/shvatka/core/models/dto/action/keys.py b/shvatka/core/models/dto/action/keys.py index 04a45551..7b61690f 100644 --- a/shvatka/core/models/dto/action/keys.py +++ b/shvatka/core/models/dto/action/keys.py @@ -92,10 +92,7 @@ def check(self, action: Action, state_holder: StateHolder) -> Decision: if not state.is_duplicate(action): if self._is_all_typed(action, state): return LevelUpKeyDecision( - type=DecisionType.LEVEL_UP, - key_type=enums.KeyType.simple - if self._is_correct(action) - else enums.KeyType.wrong, + key_type=self._get_key_type(action), # TODO always simple duplicate=state.is_duplicate(action), key=action.key, next_level=self.next_level, @@ -106,11 +103,14 @@ def check(self, action: Action, state_holder: StateHolder) -> Decision: type_ = DecisionType.NO_ACTION return KeyDecision( type=type_, - key_type=enums.KeyType.simple if self._is_correct(action) else enums.KeyType.wrong, + key_type=self._get_key_type(action), # TODO always simple duplicate=state.is_duplicate(action), key=action.key, ) + def _get_key_type(self, action: TypedKeyAction): + return enums.KeyType.simple if self._is_correct(action) else enums.KeyType.wrong + def _is_correct(self, action: TypedKeyAction) -> bool: return action.key in self.keys