Skip to content

Commit

Permalink
Merge pull request #965 from readthedocs/davidfischer/show-niche-targ…
Browse files Browse the repository at this point in the history
…eting-flight-status

Niche targeting flight status
  • Loading branch information
davidfischer authored Dec 18, 2024
2 parents bb3e5c9 + 9c748b2 commit 3434d94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions adserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,11 @@ def get_exclude_countries_display(self):
def get_days_display(self):
return [day.capitalize() for day in self.days]

def get_analyzed_urls_display(self):
if "adserver.analyzer" not in settings.INSTALLED_APPS:
return []
return [aau.url for aau in self.analyzedadvertiserurl_set.all()]

def show_to_geo(self, geo_data):
"""
Check if a flight is valid for a given country code.
Expand Down
5 changes: 5 additions & 0 deletions adserver/templates/adserver/includes/flight-metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
{% if flight.targeting_parameters.days %}
<li>{% blocktrans with value=flight.get_days_display|join:', ' %}Days: {{ value }}{% endblocktrans %}</li>
{% endif %}
{% if flight.targeting_parameters.niche_targeting %}
{% with flight.get_analyzed_urls_display|join:', ' as urls %}
<li>{% blocktrans with value=flight.niche_targeting|floatformat:2 %}Niche: Similarity {{ value }} to {{ urls }}{% endblocktrans %}</li>
{% endwith %}
{% endif %}
</ul>
</dd>
{% endif %}
Expand Down

0 comments on commit 3434d94

Please sign in to comment.