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

Flight hard stop #772

Merged
merged 4 commits into from
Jul 27, 2023
Merged

Flight hard stop #772

merged 4 commits into from
Jul 27, 2023

Conversation

davidfischer
Copy link
Collaborator

Some advertisers running a time sensitive event want a hard stop date for their flight.

Right now, the hard stop can only be set in the Django admin but it is displayed to the user when set. The hard stop lowers the impressions/clicks so the flight is completely fulfilled. Then the normal flight wrapup email is sent at the normal time.

Some advertisers running a time sensitive event
want a hard stop date for their flight.
@davidfischer davidfischer requested a review from a team as a code owner July 18, 2023 16:34
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Simple enough, but not 100% sure we want to be adjusting data on the flight.

adserver/models.py Outdated Show resolved Hide resolved
Comment on lines 1042 to 1043
if flight.clicks_remaining() <= 0 and flight.views_remaining() <= 0:
continue
Copy link
Member

Choose a reason for hiding this comment

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

Could probably use a comment. Are we skipping this because it finished properly?

Suggested change
if flight.clicks_remaining() <= 0 and flight.views_remaining() <= 0:
continue
# Don't execute for flights that properly finished
if flight.clicks_remaining() <= 0 and flight.views_remaining() <= 0:
continue

adserver/tasks.py Outdated Show resolved Hide resolved
adserver/tasks.py Outdated Show resolved Hide resolved
@davidfischer
Copy link
Collaborator Author

After discussion, I'm thinking about having a "hard stop" boolean and use the end_date.

davidfischer and others added 2 commits July 25, 2023 16:39
Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com>
@davidfischer
Copy link
Collaborator Author

I switched hard_stop to a boolean and worked the code into the same "completed flight" code.

Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

I like this approach, seems cleaner and doesn't lose data 👍

adserver/models.py Show resolved Hide resolved
@davidfischer davidfischer merged commit 90d443b into main Jul 27, 2023
1 check passed
@davidfischer davidfischer deleted the davidfischer/flight-hard-stop branch July 27, 2023 21:36
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