feat: disable allowed enrollment if enrollment closed

This commit is contained in:
Kaustav Banerjee
2021-12-09 12:23:53 +05:30
committed by Piotr Surowiec
parent d7f2b555c7
commit 99cd4a4715
12 changed files with 233 additions and 38 deletions

View File

@@ -534,6 +534,12 @@ class CourseOverview(TimeStampedModel):
"""
return course_metadata_utils.has_course_ended(self.end)
def is_enrollment_open(self):
"""
Returns True if course enrollment is open
"""
return course_metadata_utils.is_enrollment_open(self.enrollment_start, self.enrollment_end)
def has_marketing_url(self):
"""
Returns whether the course has marketing url.

View File

@@ -141,6 +141,7 @@ class CourseOverviewTestCase(CatalogIntegrationMixin, ModuleStoreTestCase, Cache
('clean_id', ('#',)),
('has_ended', ()),
('has_started', ()),
('is_enrollment_open', ()),
]
for method_name, method_args in methods_to_test:
course_value = getattr(course, method_name)(*method_args)