Skip to content

Commit

Permalink
Adding survey swap group to embedded data
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-moore-97 committed Feb 6, 2024
1 parent 0996c37 commit b8df2ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
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

0 comments on commit b8df2ca

Please sign in to comment.