Skip to content

Commit

Permalink
Merge pull request #1055 from dimagi/cs/update_connect_channel
Browse files Browse the repository at this point in the history
Get participant data from the working version
  • Loading branch information
SmittieC authored Jan 17, 2025
2 parents a76c5eb + 730d392 commit 3fc7692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/channels/tests/test_connect_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def test_multiple_messages_are_sorted_and_concatenated(self, CommCareConnectChan
def test_bot_generate_and_sends_message(self, process_input, experiment):
process_input.return_value = "Hi human"
commcare_connect_channel_id, encryption_key, experiment_channel, data, payload = _setup(experiment)
# The version will be used when chatting to the bot
experiment.create_new_version(make_default=True)

with patch("apps.chat.channels.CommCareConnectClient") as ConnectClientMock:
client_mock = ConnectClientMock.return_value
Expand Down
5 changes: 4 additions & 1 deletion apps/chat/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,10 @@ def send_text_to_user(self, text: str):

@cached_property
def participant_data(self) -> ParticipantData:
return self.experiment.participant_data.defer("data").get(participant__identifier=self.participant_identifier)
experiment = self.experiment
if self.experiment.is_a_version:
experiment = self.experiment.working_version
return experiment.participant_data.defer("data").get(participant__identifier=self.participant_identifier)

@cached_property
def connect_channel_id(self) -> str:
Expand Down

0 comments on commit 3fc7692

Please sign in to comment.