Skip to content

Commit

Permalink
feat: add the default enrollment start date on course creation (#33150)
Browse files Browse the repository at this point in the history
This is a backport from the master branch:
openedx/edx-platform#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).
  • Loading branch information
dyudyunov authored and bra-i-am committed Apr 16, 2024
1 parent c4595d4 commit e637c45
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions xmodule/course_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
COURSE_VISIBILITY_PUBLIC_OUTLINE = 'public_outline'
COURSE_VISIBILITY_PUBLIC = 'public'

COURSE_VIDEO_SHARING_PER_VIDEO = 'per-video'
COURSE_VIDEO_SHARING_ALL_VIDEOS = 'all-on'
COURSE_VIDEO_SHARING_NONE = 'all-off'
# .. toggle_name: FEATURES['CREATE_COURSE_WITH_DEFAULT_ENROLLMENT_START_DATE']
# .. toggle_implementation: SettingDictToggle
# .. toggle_default: False
Expand Down

0 comments on commit e637c45

Please sign in to comment.