Skip to content

Enrolments not working for anonymous users #153

@ivanistheone

Description

@ivanistheone

I'm trying to test a simple page modification as follows:

{% experiment subtitle_text control %}
    <h3>Check it out.</h3>
{% endexperiment %}

{% experiment subtitle_text explicit %}
    <h3>Check this shit out!</h3>
{% endexperiment %}

but the control alternative is always shown to non-logged in users, as if the "enrolment" part of the process is not happening.

It seems everything else is in place though, since the admin user (user_id=1) got enrolled:

sqlite> select * from experiments_experiment;
subtitle_text|What should be below the title|{"control":{"default":true,"enabled":true},"explicit":{"enabled":true}}|||3|2016-09-25 21:38:50.341160|

sqlite> select * from experiments_enrollment;
1|2016-09-25 22:31:09.158882|2016-09-25 22:48:15.654098|explicit|subtitle_text|1

also I see some count data was stored in redis:

redis> HGETALL experiments:freq:subtitle_text:explicit:participant
1) "1"
2) "1"

redis> HGETALL "experiments:participants:subtitle_text:explicit:participant"
1) "user:1"
2) "1"

Is there anything I need to do to enable non-logged in user (i.e. session-based) experiment enrolment?

Also a few words about the high-level design of the project would be very useful:

  • What's stored in the DB
  • what is stored in Redis,
  • what data is being attached to the request and response objects
    This info will help me debug and hopefully contribute a PR to fix the issue.

I'm using Django 1.10, but I also donwgraded to Django 1.9.9 and anonymous users are still not being enroled.

I have a suspicion the issue is related to the change to way request context processors are used in Django 1.8 (i.e. no more RequestContext). For the record, here are the context processors for my project:

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions