Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def apps_opened(view, applications):
event_name = 'app_opened'
for application in applications:
log_to_mixpanel.delay(
distinct_id=application.form_submission.get_uuid(),
event_name=event_name,
application_id=application.id,
application_organization_name=application.organization.name,
**mixpanel_applicant_data(application.form_submission.applicant),
**mixpanel_data_from_view_request_user(view))
additional_info_length=len(status_update.additional_information),
other_next_steps_length=len(status_update.other_next_step),
message_change_ratio=SNService.get_message_change_ratio(status_update),
contact_info_keys=SNService.get_contact_info_keys(status_update),
has_unsent_additional_info=SNService.has_unsent_additional_info(
status_update),
has_unsent_other_next_step=SNService.has_unsent_other_next_step(
status_update),
**mixpanel_applicant_data(
status_update.application.form_submission.applicant),
**mixpanel_data_from_view_request_user(view))
if hasattr(status_update, 'notification'):
event_kwargs.update(
notification_contact_info_types=list(
status_update.notification.contact_info.keys()))
log_to_mixpanel.delay(**event_kwargs)
def user_failed_login(view):
event_name = 'user_failed_login'
log_to_mixpanel.delay(
distinct_id=view.request.visitor.get_uuid(),
event_name=event_name,
attempted_login=view.request.POST.get('login', ''),
**mixpanel_data_from_view_request_user(view))
def partnership_interest_submitted(view, partnership_lead):
event_name = 'partnership_interest_submitted'
log_to_mixpanel.delay(
distinct_id=partnership_lead.visitor.get_uuid(),
event_name=event_name,
**mixpanel_data_from_view_request_user(view))
def form_page_complete(view):
"""page_name should be the class name of the view instance.
"""
event_name = 'application_page_complete'
applicant = ApplicantsService.get_applicant_from_request_or_session(
view.request)
log_to_mixpanel.delay(
distinct_id=applicant.get_uuid(),
event_name=event_name,
**mixpanel_applicant_data(applicant),
**mixpanel_data_from_view_request_user(view))
def user_apps_searched(view):
event_name = 'user_apps_searched'
log_to_mixpanel.delay(
distinct_id=view.request.user.profile.get_uuid(),
event_name=event_name,
**mixpanel_data_from_view_request_user(view))
def unread_pdf_opened(request, view):
# not currently used
applicant_event_name = 'app_unread_pdf_opened'
user_event_name = 'user_unread_pdf_opened'
log_to_mixpanel.delay(
distinct_id=request.user.get_uuid(),
event_name=user_event_name,
organization_name=view.organization.name)
for app in view.applications:
log_to_mixpanel.delay(
distinct_id=app.get_uuid(),
event_name=applicant_event_name,
bundle_organization_name=app.organization.name,
user_email=request.user.email,
user_organization_name=request.user.profile.organization.name)
def user_reset_password(view, email):
event_name = 'user_reset_password'
log_to_mixpanel.delay(
distinct_id=view.request.visitor.get_uuid(),
event_name=event_name,
email=email,
**mixpanel_data_from_view_request_user(view))
def site_entered(visitor, request):
event_name = 'site_entered'
log_to_mixpanel.delay(
distinct_id=visitor.get_uuid(),
event_name=event_name,
**mixpanel_request_data(request))
def user_apps_opened(view, applications):
event_name = 'user_app_opened'
for application in applications:
log_to_mixpanel.delay(
distinct_id=view.request.user.profile.get_uuid(),
event_name=event_name,
application_id=application.id,
applicant_uuid=application.form_submission.get_uuid(),
application_organization_name=application.organization.name,
**mixpanel_applicant_data(application.form_submission.applicant),
**mixpanel_data_from_view_request_user(view)
)