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

CORE-2017: added support for specified start dates #65

Merged
merged 3 commits into from
Feb 6, 2025
Merged

Conversation

slr71
Copy link
Collaborator

@slr71 slr71 commented Feb 3, 2025

The purpose of this change is to enable subscription renewals. The basic use case is that the user has a subscription that lasts until a specific date and wants to extend the subscription. This will be done by creating a new subscription with its effective date set to the time when the current subscription ends. Since this is a generalized feature, we need to address cases where subscriptions overlap.

Copy link
Member

@psarando psarando left a comment

Choose a reason for hiding this comment

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

I didn't catch any issues 👍

Copy link
Collaborator

@ianmcorvidae ianmcorvidae left a comment

Choose a reason for hiding this comment

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

Just spotted a couple typos, otherwise I think this looks right to me.

Where("users.username=?", username).
Where(
db.Where("? BETWEEN subscriptions.effective_start_date AND subscriptions.effective_end_date", date).
Or("? > subscriptions.effective_start_date AND subscriptions.effecrtive_end_date IS NULL"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

effecrtive is a typo here, I suspect

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, yes, that is a typo. Thanks for catching that.

@@ -265,8 +301,8 @@ func ListSubscriptions(ctx context.Context, db *gorm.DB, params *SubscriptionLis
// GetActiveSubscriptionDetails retrieves the user plan information that is currently active for the user. The effective
// start date must be before the current date and the effective end date must either be null or after the current date.
// If multiple active user plans exist, the one with the most recent effective start date is used. If no active user
// plans exist for the user then a new one for the basic plan is created. This funciton is like GetActiveSubscription except
// that it also loads all of the user plan details from the database.
// plans exist for the user then a new one for the basic plan is created. This funciton is like GetActiveSubscription
Copy link
Collaborator

Choose a reason for hiding this comment

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

unimportant but: funciton

@slr71
Copy link
Collaborator Author

slr71 commented Feb 6, 2025

Thanks for the reviews! 👍

@slr71 slr71 merged commit 3732ea2 into cyverse:main Feb 6, 2025
1 check passed
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.

3 participants