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

update bounty expiry date to hackthon end date #8698

Merged

Conversation

thelostone-mc
Copy link
Member

Issue

@connoroday

Problem: When extending hackathon end date, bounties expiration doesn’t change
Request: Bounty deadlines get updated when hackathon is extended

How to use
  • Head over to a hackathon event in admin
  • Update the end date and click on SAVE
  • Once the hackathon end date has been updated, scroll to the bottom and hit the Update Related Bounties Expiry Date button and all the bounties for the hackathon event should have the same expiry date.

Check the video for more info

Untitled

bounties_to_extend = Bounty.objects.filter(event=obj)
for bounty in bounties_to_extend:
bounty.expires_date=obj.end_date
bounty.save()
Copy link
Member Author

Choose a reason for hiding this comment

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

^ tried using bulk save here but that didn't seem to work in admin as expected hence defaulting to saving one record at a time

Copy link
Contributor

Choose a reason for hiding this comment

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

There's never going to be an unreasonable amount of entries anyway, and this is an admin function so should be fine

@connoroday
Copy link
Contributor

This looks perfect! Thank you

Copy link
Contributor

@gdixon gdixon left a comment

Choose a reason for hiding this comment

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

Codewise LGTM! The only niggle I have is with the _auto_ part of the name, this would imply that it's not something that can be ran manually -- would _bulk_update_expiry make more sense?

bounties_to_extend = Bounty.objects.filter(event=obj)
for bounty in bounties_to_extend:
bounty.expires_date=obj.end_date
bounty.save()
Copy link
Contributor

Choose a reason for hiding this comment

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

There's never going to be an unreasonable amount of entries anyway, and this is an admin function so should be fine

@thelostone-mc
Copy link
Member Author

@gdixon updated

@thelostone-mc thelostone-mc merged commit f087098 into gitcoinco:master Apr 1, 2021
iRhonin pushed a commit to iRhonin/web that referenced this pull request Apr 23, 2021
* update bounty expiry date to hackthon end date

* Update change_form.html

* Update admin.py
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.

None yet

4 participants