Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (redirect): Adding survey swap group to embedded data #94

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions qualtrix/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class RedirectModel(SurveyModel):
targetSurveyId: str
RulesConsentID: str # Client dependent
SurveyswapID: str # Client dependent
SurveyswapGroup: str # Client dependent
utm_campaign: str
utm_medium: str
utm_source: str
Expand Down Expand Up @@ -86,6 +87,7 @@ async def intake_redirect(request: RedirectModel):
directory_entry["id"],
request.RulesConsentID,
request.SurveyswapID,
request.SurveyswapGroup,
request.utm_campaign,
request.utm_medium,
request.utm_source,
Expand Down Expand Up @@ -126,6 +128,7 @@ async def add_user_to_contact_list(
contact_id: str,
rules_consent_id: str,
survey_swap_id: str,
survey_swap_group: str,
utm_campaign: str,
utm_medium: str,
utm_source: str,
Expand All @@ -140,6 +143,8 @@ async def add_user_to_contact_list(
client.modify_prefix("FS", "R", rules_consent_id),
settings.SURVEY_SWAP_ID_LABEL,
survey_swap_id,
settings.SURVEY_SWAP_GROUP_LABEL,
survey_swap_group,
contact_id,
utm_campaign,
utm_medium,
Expand Down
3 changes: 3 additions & 0 deletions qualtrix/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ def add_participant_to_contact_list(
rules_consent_id: str,
survey_swap_id_label: str,
survey_swap_id,
survey_swap_group_label: str,
survey_swap_group: str,
contact_id: str,
utm_campaign: str,
utm_medium: str,
Expand All @@ -213,6 +215,7 @@ def add_participant_to_contact_list(
survey_label: survey_link,
rules_consent_id_label: rules_consent_id,
survey_swap_id_label: survey_swap_id,
survey_swap_group_label: survey_swap_group,
"utm_campaign": utm_campaign,
"utm_medium": utm_medium,
"utm_source": utm_source,
Expand Down
3 changes: 3 additions & 0 deletions qualtrix/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
DEMOGRAPHICS_SURVEY_LABEL = None
RULES_CONSENT_ID_LABEL = None
SURVEY_SWAP_ID_LABEL = None
SURVEY_SWAP_GROUP_LABEL = None

try:
vcap_services = os.getenv("VCAP_SERVICES")
Expand Down Expand Up @@ -65,6 +66,7 @@
DEMOGRAPHICS_SURVEY_LABEL = config["demographics_survey_label"]
RULES_CONSENT_ID_LABEL = config["rules_consent_id_label"]
SURVEY_SWAP_ID_LABEL = config["survey_swap_id_label"]
SURVEY_SWAP_GROUP_LABEL = config["survey_swap_group_label"]

else:
API_TOKEN = os.getenv("QUALTRIX_API_TOKEN")
Expand All @@ -83,6 +85,7 @@
DEMOGRAPHICS_SURVEY_LABEL = os.getenv("QUALTRIX_DEMOGRAPHICS_SURVEY_LABEL")
RULES_CONSENT_ID_LABEL = os.getenv("QUALTRIX_RULES_CONSENT_ID_LABEL")
SURVEY_SWAP_ID_LABEL = os.getenv("QUALTRIX_SURVEY_SWAP_ID_LABEL")
SURVEY_SWAP_GROUP_LABEL = os.getenv("QUALTRIX_SURVEY_SWAP_GROUP_LABEL")

except (json.JSONDecodeError, KeyError, FileNotFoundError) as err:
log.warning("Unable to load credentials from VCAP_SERVICES")
Expand Down