Commit 1cd54d5f by cahrens

Rename "is_default_cohort" method.

parent ce6ffe6d
...@@ -12,7 +12,7 @@ from courseware.courses import get_course_by_id ...@@ -12,7 +12,7 @@ from courseware.courses import get_course_by_id
from verified_track_content.tasks import sync_cohort_with_mode from verified_track_content.tasks import sync_cohort_with_mode
from openedx.core.djangoapps.course_groups.cohorts import ( from openedx.core.djangoapps.course_groups.cohorts import (
get_course_cohorts, CourseCohort, is_course_cohorted, get_random_cohort, is_default_cohort get_course_cohorts, CourseCohort, is_course_cohorted, get_random_cohort
) )
import logging import logging
......
...@@ -430,7 +430,7 @@ def set_assignment_type(user_group, assignment_type): ...@@ -430,7 +430,7 @@ def set_assignment_type(user_group, assignment_type):
""" """
course_cohort = user_group.cohort course_cohort = user_group.cohort
if is_default_cohort(user_group) and course_cohort.assignment_type != assignment_type: if is_last_random_cohort(user_group) and course_cohort.assignment_type != assignment_type:
raise ValueError(_("There must be one cohort to which students can automatically be assigned.")) raise ValueError(_("There must be one cohort to which students can automatically be assigned."))
course_cohort.assignment_type = assignment_type course_cohort.assignment_type = assignment_type
...@@ -445,9 +445,9 @@ def get_assignment_type(user_group): ...@@ -445,9 +445,9 @@ def get_assignment_type(user_group):
return course_cohort.assignment_type return course_cohort.assignment_type
def is_default_cohort(user_group): def is_last_random_cohort(user_group):
""" """
Check if a cohort is default. Check if this cohort is the only random cohort in the course.
""" """
random_cohorts = CourseUserGroup.objects.filter( random_cohorts = CourseUserGroup.objects.filter(
course_id=user_group.course_id, course_id=user_group.course_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment