Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5df6e0e58 | |||
865efd0792 | |||
454c936e0f | |||
74d3123084 | |||
9bfd816430 |
4
CHANGES
4
CHANGES
@ -1,3 +1,7 @@
|
|||||||
|
0.11.2
|
||||||
|
==================
|
||||||
|
- Bugfix: Stop populating static segments when the count is reached
|
||||||
|
|
||||||
0.11.1
|
0.11.1
|
||||||
==================
|
==================
|
||||||
- Populate entirely static segments from registered Users not active Sessions
|
- Populate entirely static segments from registered Users not active Sessions
|
||||||
|
@ -55,10 +55,10 @@ author = 'Lab Digital BV'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.11.1'
|
version = '0.11.2'
|
||||||
|
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.11.1'
|
release = '0.11.2'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.11.1
|
current_version = 0.11.2
|
||||||
commit = true
|
commit = true
|
||||||
tag = true
|
tag = true
|
||||||
tag_name = {new_version}
|
tag_name = {new_version}
|
||||||
|
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ with open('README.rst') as fh:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='wagtail-personalisation-molo',
|
name='wagtail-personalisation-molo',
|
||||||
version='0.11.1',
|
version='0.11.2',
|
||||||
description='A forked version of Wagtail add-on for showing personalized content',
|
description='A forked version of Wagtail add-on for showing personalized content',
|
||||||
author='Praekelt.org',
|
author='Praekelt.org',
|
||||||
author_email='dev@praekeltfoundation.org',
|
author_email='dev@praekeltfoundation.org',
|
||||||
|
@ -116,7 +116,7 @@ class SegmentAdminForm(WagtailAdminModelForm):
|
|||||||
passes = adapter._test_rules(instance.get_rules(), request, instance.match_any)
|
passes = adapter._test_rules(instance.get_rules(), request, instance.match_any)
|
||||||
if passes:
|
if passes:
|
||||||
matched_count += 1
|
matched_count += 1
|
||||||
if instance.count == 0 or len(users_to_add) <= instance.count:
|
if instance.count == 0 or len(users_to_add) < instance.count:
|
||||||
if instance.randomise_into_segment():
|
if instance.randomise_into_segment():
|
||||||
users_to_add.append(user)
|
users_to_add.append(user)
|
||||||
else:
|
else:
|
||||||
|
@ -45,6 +45,20 @@ def test_user_added_to_static_segment_at_creation(site, user, mocker):
|
|||||||
assert user in instance.static_users.all()
|
assert user in instance.static_users.all()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_user_not_added_to_full_static_segment_at_creation(site, django_user_model, mocker):
|
||||||
|
django_user_model.objects.create(username='first')
|
||||||
|
django_user_model.objects.create(username='second')
|
||||||
|
segment = SegmentFactory.build(type=Segment.TYPE_STATIC, count=1)
|
||||||
|
rule = VisitCountRule(counted_page=site.root_page)
|
||||||
|
form = form_with_data(segment, rule)
|
||||||
|
mocker.patch('wagtail_personalisation.rules.VisitCountRule.test_user',
|
||||||
|
side_effect=[True, True])
|
||||||
|
instance = form.save()
|
||||||
|
|
||||||
|
assert len(instance.static_users.all()) == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_anonymous_user_not_added_to_static_segment_at_creation(site, client, mocker):
|
def test_anonymous_user_not_added_to_static_segment_at_creation(site, client, mocker):
|
||||||
session = client.session
|
session = client.session
|
||||||
|
Reference in New Issue
Block a user