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

Add the default enrollment start date on course creation #33150

Conversation

dyudyunov
Copy link
Contributor

This is a backport from the master branch:
#30954

The course is visible on the main page right after creation.

So anonymous users can see them and access the course about page for the courses without valid data (e.g. they will see the default course overview)

When courses list filtering is processed it checks the see_exists permission for the anonymous user.
Actually, see_exists means can_load OR can_enroll.

can_load is False in our case because the course start in the future.

But can_enroll returns True because the course's enrollment_start and enrollment_end dates are blank:

enrollment_start = courselike.enrollment_start or datetime.min.replace(tzinfo=UTC)
enrollment_end = courselike.enrollment_end or datetime.max.replace(tzinfo=UTC)
if enrollment_start < now < enrollment_end:
    debug("Allow: in enrollment period")
    return ACCESS_GRANTED

Set the enrollment_start the same as a course start by default if the CREATE_COURSE_WITH_DEFAULT_ENROLLMENT_START_DATE feature toggle is enabled (default is False).

This is a backport from the master branch:
openedx#30954

The course is visible on the main page right after creation.

So anonymous users can see them and access the course about page
for the courses without valid data (e.g. they will see the default
course overview)

When courses list filtering is processed it checks the `see_exists`
permission for the anonymous user.
Actually, `see_exists` means `can_load` OR `can_enroll`.

`can_load` is False in our case because the course start in the future.

But `can_enroll` returns True because the course's enrollment_start
and enrollment_end dates are blank:
```
enrollment_start = courselike.enrollment_start or datetime.min.replace(tzinfo=UTC)
enrollment_end = courselike.enrollment_end or datetime.max.replace(tzinfo=UTC)
if enrollment_start < now < enrollment_end:
    debug("Allow: in enrollment period")
    return ACCESS_GRANTED
```

Set the enrollment_start the same as a course start by default
if the CREATE_COURSE_WITH_DEFAULT_ENROLLMENT_START_DATE
feature toggle is enabled (default is False).
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 1, 2023
@openedx-webhooks
Copy link

Thanks for the pull request, @dyudyunov! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@dyudyunov
Copy link
Contributor Author

@mariajgrimaldi hi! 👋

Please review)
This is a backport of #30954

@mariajgrimaldi
Copy link
Member

@dyudyunov: remember to update the PR name so it's consistent with the one against master! Thanks

@dyudyunov dyudyunov changed the title fix: main page course listing Add the default enrollment start date on course creation Sep 1, 2023
@dyudyunov
Copy link
Contributor Author

@dyudyunov: remember to update the PR name so it's consistent with the one against master! Thanks

Done, thanks

@mariajgrimaldi mariajgrimaldi merged commit d59db28 into openedx:open-release/palm.master Sep 5, 2023
@openedx-webhooks
Copy link

@dyudyunov 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@GlugovGrGlib GlugovGrGlib deleted the palm/fix-main-page-course-visibility branch September 20, 2023 17:20
shURenZHOUluxun pushed a commit to EduTrigger/edx-platform that referenced this pull request Jan 3, 2024
…dx#33150)

This is a backport from the master branch:
openedx#30954

The course is visible on the main page right after creation.

So anonymous users can see them and access the course about page
for the courses without valid data (e.g. they will see the default
course overview)

When courses list filtering is processed it checks the `see_exists`
permission for the anonymous user.
Actually, `see_exists` means `can_load` OR `can_enroll`.

`can_load` is False in our case because the course start in the future.

But `can_enroll` returns True because the course's enrollment_start
and enrollment_end dates are blank:
```
enrollment_start = courselike.enrollment_start or datetime.min.replace(tzinfo=UTC)
enrollment_end = courselike.enrollment_end or datetime.max.replace(tzinfo=UTC)
if enrollment_start < now < enrollment_end:
    debug("Allow: in enrollment period")
    return ACCESS_GRANTED
```

Set the enrollment_start the same as a course start by default
if the CREATE_COURSE_WITH_DEFAULT_ENROLLMENT_START_DATE
feature toggle is enabled (default is False).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants