Esempio n. 1
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.drill_instance_id = None
     dialog_state.current_prompt_state = None
     dialog_state.current_drill = None
     dialog_state.user_profile.validated = True
     dialog_state.user_profile.is_demo = self.code_validation_payload.is_demo
     dialog_state.user_profile.account_info = self.code_validation_payload.account_info
Esempio n. 2
0
 def apply_to(self, dialog_state: DialogState) -> None:
     if self.abandoned:
         dialog_state.current_prompt_state = None
     else:
         assert dialog_state.current_prompt_state
         dialog_state.current_prompt_state.last_response_time = self.created_time
         dialog_state.current_prompt_state.failures += 1
Esempio n. 3
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.current_prompt_state = None
     if self.prompt.response_user_profile_key:
         setattr(
             dialog_state.user_profile,
             self.prompt.response_user_profile_key,
             self.response,
         )
Esempio n. 4
0
 def apply_to(self, dialog_state: DialogState) -> None:
     # TODO: revisit this (pretty unfortunate) updating logic. Maybe we should always just
     # overwrite the dialog engine user profile data from scadmin, rather than having two
     # sources of truth?
     account_info = dialog_state.user_profile.account_info
     if "account_info" in self.user_profile_data:
         account_info = (account_info.copy(
             update=self.user_profile_data["account_info"])
                         if account_info else AccountInfo(
                             **self.user_profile_data["account_info"]))
     dialog_state.user_profile = dialog_state.user_profile.copy(
         update=self.user_profile_data)
     dialog_state.user_profile.account_info = account_info
     if self.purge_drill_state:
         dialog_state.current_drill = None
         dialog_state.drill_instance_id = None
         dialog_state.current_prompt_state = None
Esempio n. 5
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.current_drill = self.drill
     dialog_state.drill_instance_id = self.drill_instance_id
     dialog_state.current_prompt_state = PromptState(
         slug=self.first_prompt.slug, start_time=self.created_time)
Esempio n. 6
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.current_drill = None
     dialog_state.drill_instance_id = None
     dialog_state.current_prompt_state = None
     dialog_state.user_profile.opted_out = False
Esempio n. 7
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.current_drill = None
     dialog_state.drill_instance_id = None
     dialog_state.current_prompt_state = None
Esempio n. 8
0
 def apply_to(self, dialog_state: DialogState) -> None:
     dialog_state.current_prompt_state = PromptState(
         slug=self.prompt.slug, start_time=self.created_time)