From f3da0eb5dec88c3f3a938f8fa388e564ebf77fcc Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 2 May 2017 14:56:24 -0400 Subject: [PATCH] Implement a naive PartitionScheme for ICRV --- .../djangoapps/user_api/partition_schemes.py | 21 ++++++++++++++++--- setup.py | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/user_api/partition_schemes.py b/openedx/core/djangoapps/user_api/partition_schemes.py index a78c2b3415..a772a1260b 100644 --- a/openedx/core/djangoapps/user_api/partition_schemes.py +++ b/openedx/core/djangoapps/user_api/partition_schemes.py @@ -17,11 +17,26 @@ class NotImplementedPartitionScheme(object): """ @classmethod - def get_group_for_user(cls, course_key, user, user_partition, assign=True, track_function=None): + def get_group_for_user(cls, course_key, user, user_partition, assign=True, track_function=None): # pylint: disable=unused-argument """ - Dummy method, will fail hard if anyone tries to use this scheme. + Returning None is equivalent to saying "This user is not in any groups + using this partition scheme", be sure the scheme you're removing is + compatible with that assumption. """ - raise NotImplementedError() + return None + + +class ReturnGroup1PartitionScheme(object): + """ + This scheme is needed to allow verification partitions to be killed, see EDUCATOR-199 + """ + @classmethod + def get_group_for_user(cls, course_key, user, user_partition, assign=True, track_function=None): # pylint: disable=unused-argument + """ + The previous "allow" definition for verification was defined as 1, so return that. + Details at https://github.com/edx/edx-platform/pull/14913/files#diff-feff1466ec4d1b8c38894310d8342a80 + """ + return user_partition.get_group(1) class RandomUserPartitionScheme(object): diff --git a/setup.py b/setup.py index 9d3527ed78..5a16348e42 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup( "openedx.user_partition_scheme": [ "random = openedx.core.djangoapps.user_api.partition_schemes:RandomUserPartitionScheme", "cohort = openedx.core.djangoapps.course_groups.partition_scheme:CohortPartitionScheme", - "verification = openedx.core.djangoapps.user_api.partition_schemes:NotImplementedPartitionScheme", + "verification = openedx.core.djangoapps.user_api.partition_schemes:ReturnGroup1PartitionScheme", "enrollment_track = openedx.core.djangoapps.verified_track_content.partition_scheme:EnrollmentTrackPartitionScheme", ], "openedx.block_structure_transformer": [