-
Notifications
You must be signed in to change notification settings - Fork 2
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
✨(backend) add start
and end
date on OrderGroup
model
#1032
Open
jonathanreveille
wants to merge
6
commits into
main
Choose a base branch
from
feat/add_start_and_end_date_to_ordergroup_model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
✨(backend) add start
and end
date on OrderGroup
model
#1032
jonathanreveille
wants to merge
6
commits into
main
from
feat/add_start_and_end_date_to_ordergroup_model
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
900f92a
to
b844aa3
Compare
kernicPanel
reviewed
Jan 30, 2025
b48a129
to
5355f60
Compare
jbpenrath
reviewed
Feb 3, 2025
1da6d5b
to
a3c4153
Compare
start
and end
date on OrderGroup
model
kernicPanel
reviewed
Feb 4, 2025
3489399
to
2691264
Compare
356a85c
to
b5ca298
Compare
6a96e10
to
3aa2362
Compare
kernicPanel
reviewed
Feb 6, 2025
3aa2362
to
b8310ee
Compare
We want to be able to define a starting and ending date on order groups. This will allow to use them as promotional sessions on a given course with a fix number of available seats. For now, order groups work just as before, but if you define a starting date, you should define also an ending date of validity.
1fd8c49
to
6339b81
Compare
6339b81
to
371e71a
Compare
kernicPanel
approved these changes
Feb 7, 2025
@@ -379,6 +381,28 @@ class OrderGroup(BaseModel): | |||
on_delete=models.CASCADE, | |||
) | |||
is_active = models.BooleanField(_("is active"), default=True) | |||
# Available start to end period of activation of the OrderGroup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
# Available start to end period of activation of the OrderGroup |
@@ -379,6 +381,28 @@ class OrderGroup(BaseModel): | |||
on_delete=models.CASCADE, | |||
) | |||
is_active = models.BooleanField(_("is active"), default=True) | |||
# Available start to end period of activation of the OrderGroup | |||
start = models.DateTimeField( | |||
help_text=_("order group’s start date and time"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this ?
Suggested change
help_text=_("order group’s start date and time"), | |
help_text=_("Date at which the order group activation begins"), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request will solve this issue.
We want to be able to define a start and end date on order groups. This will allow us to use them as promotional periods such as : early bird, last minute or promotional sales.
Here is the logic applied :
is_active
set toFalse
: we don’t calculate anything, we returnFalse
(value in db).is_active
set toTrue
and no date is defined: we returnTrue
(value in db).is_active
set to True, but the current date is not within the interval between the start ofcourse_run.enrollment_start
and the date oforder_group.end
: we returnFalse
. If it is within the interval, we returnTrue
.is_active
set toTrue
, but the current date is not within the interval between the start ofcourse_run.enrollment_end
and the date oforder_group.start
: we returnFalse
. If it is within the interval, we returnTrue
.is_active
set toTrue
, and the current date is within the interval: we returnTrue
. If the date is not within the interval, we returnFalse
.Only when
is_active
is set to True do we determine whether it is enabled or not.The above conditions should also take into account whether there are still available seats in the order group.
Proposal
start
andend
datetime fields onOrderGroup
model