Skip to content

Ensure participants do not get reassigned if the server restarts #25

@mihaiconstantin

Description

@mihaiconstantin

For example, something like this:

# Get the participant model from the database by the code.
participant_model: ParticipantModel = storage.get_participant(user.identifier)

# If the participant is not assigned to a condition.
if not participant_model.condition:
    # Randomly assign a new participant to one of the study conditions.
    boterview.assign_participant(user.identifier)

    # Get the assigned participant object.
    participant: Participant = boterview.retrieve_participant(user.identifier)

    # Update the participant condition.
    participant_model.condition = participant.condition_name # type: ignore

    # Update the participant prompt.
    participant_model.prompt = participant.prompt # type: ignore

    # Save the participant record.
    participant_model.save()

# ...

Metadata

Metadata

Labels

enhancementIndicates a feature request or a change adding a new feature

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions