-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server can control multiple publisher placements #786
Server can control multiple publisher placements #786
Conversation
adserver/api/serializers.py
Outdated
@@ -60,6 +60,10 @@ class AdDecisionSerializer(serializers.Serializer): | |||
# This purposefully doesn't use a URLField so we can disregard invalid values rather than rejecting them | |||
url = serializers.CharField(max_length=256, required=False) | |||
|
|||
# The placement index (0-indexed) | |||
# 1 or more means there's multiple placements on this page | |||
index = serializers.IntegerField(required=False, min_value=0, max_value=9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not have a max here? It seems unlikely, but I know the PSF has a use case where they're showing more than 9 images in a page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can remove it. I'd rather have a very large max (99 or even 999) than no max at all though if that makes sense though.
adserver/api/views.py
Outdated
@@ -296,6 +296,7 @@ def decision(self, request, data): | |||
keywords=keywords, | |||
campaign_types=serializer.validated_data.get("campaign_types"), | |||
url=url, | |||
placement_index=serializer.validated_data.get("index"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call the incoming variable placement_index
as well to keep it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated based on the feedback. |
Looks good 👍 |
This is based on #782 so as not to have conflicting migrations.
This change allows the server to control whether a publisher is allowed to have multiple placements (which the client sends since readthedocs/ethical-ad-client#170). When merged, this will automatically reject multiple placements and we will need to turn it on per publisher.