Skip to content
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

Conversation

davidfischer
Copy link
Collaborator

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.

@@ -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)
Copy link
Member

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.

Copy link
Collaborator Author

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.

@@ -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"),
Copy link
Member

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidfischer
Copy link
Collaborator Author

I updated based on the feedback.

@ericholscher
Copy link
Member

Looks good 👍

@davidfischer davidfischer merged commit f6b7f6a into davidfischer/pricing-in-server Oct 3, 2023
1 check passed
@davidfischer davidfischer deleted the davidfischer/publisher-multiple-placements branch October 3, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants