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

Ensure new expiration date isn't in the past when applying for a membership extension #2485

Merged
merged 3 commits into from
Aug 19, 2020
Merged

Ensure new expiration date isn't in the past when applying for a membership extension #2485

merged 3 commits into from
Aug 19, 2020

Conversation

Jorrre
Copy link
Collaborator

@Jorrre Jorrre commented Jul 14, 2020

Set new expiration date to 16/09 this year/next year (depending on when the request was sent) instead of 16/09 the year after the previous membership ended. Fix #1399

What kind of a pull request is this?

  • Bugfix
  • QA / Code Review

Code Checklist

  • The code follows dotkom code style
  • The code passes the defined tests
  • I have added tests for the code I added
  • I have provided documentation for the code I added
  • The code is ready to be merged

(Possible) Breaking Changes

  • The changes are backwards compatible
  • I have updated the build configuration
  • These changes requires changes to configuration in production
    • I have applied the required changes in production
    • I cannot apply the required changes in production before this is deployed.

Description of changes

Changed the way the new expiration date is set when applying for a membership extension

Screenshot(s) if appropriate

…en the request was sent) instead of 16/09 the year after the previous membership ended.
Copy link
Member

@henrikhorluck henrikhorluck left a comment

Choose a reason for hiding this comment

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

Thank you so much for your contribution! 🎁 It looks good to me, and I think it should work, though we ideally should have some test-cases for this 😅

membership = AllowedUsername.objects.get(username=request.user.ntnu_username)
new_expiration_date = datetime.date(membership.expiration_date.year + 1, 9, 16)
# Grant membership until 16th of September this year if the request was sent previous to 1st of July,
# or until 16th of September next year if the request was sent after 1st of July
Copy link
Member

Choose a reason for hiding this comment

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

Note: due to leap-years and such, we are not actually guaranteed for it to last until 16th of September the next year. I do not think this is something that we need to address

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright, so should it just specify that the applicant is granted membership for one year?

Copy link
Member

Choose a reason for hiding this comment

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

No, I think this is fine!

@blauks blauks merged commit d9b0611 into dotkom:develop Aug 19, 2020
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.

Updated membership "fails" for users with membership > 1 year old
3 participants