jpvanhal / flask-split

A/B testing for your Flask application.
https://flask-split.readthedocs.io/
MIT License
119 stars 37 forks source link

Full page ab test #10

Open Mitalee opened 4 years ago

Mitalee commented 4 years ago

hi,

Thanks for the simple plugin. I tried adding the following code for testing a full page:

@ab_test.route('/ab_test_full_page')
def check_full_page():
    return render_template(ab_test('page_checker','page1.html', 'page2.html'))

I get the error: TypeError: 'Blueprint' object is not callable. Would appreciate if you could let me know the correct syntax.

jpvanhal commented 4 years ago

Try naming your blueprint differently. It has the same name as Flask-Split's ab_test function.

Mitalee commented 4 years ago

Thank you. That helped! silly me.

I do get a math error ValueError now:

website_1  |   File "/usr/local/lib/python3.6/site-packages/flask_split/templates/split/index.html", line 9, in block "content"
website_1  |     {% include "split/_experiment.html" %}
website_1  |   File "/usr/local/lib/python3.6/site-packages/flask_split/templates/split/_experiment.html", line 67, in top-level template code
website_1  |     <span rel="tooltip" title="{% if alternative.z_score is not none %}z-score: {{ alternative.z_score|round(3) }}{% endif %}">
website_1  |   File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 471, in getattr
website_1  |     return getattr(obj, attribute)
website_1  |   File "/usr/local/lib/python3.6/site-packages/flask_split/models.py", line 110, in z_score
website_1  |     return mean / sqrt(var_cr + var_crc)
website_1  | ValueError: math domain error  

Made a small example app here for split url testing - https://github.com/Mitalee/flask_ab_test_example

Thanks again. It's a really wonderful plugin, with tremendous potential.