From d1040effde63740179e350e464952ed645b7db94 Mon Sep 17 00:00:00 2001 From: ruzniaievdm Date: Wed, 24 Jan 2024 12:06:54 +0200 Subject: [PATCH] fix: [AXIMST-63] Group configurations serializer and docs (#2496) --- .../v1/serializers/group_configurations.py | 4 +- .../rest_api/v1/views/group_configurations.py | 60 ++++++++++++++++++- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/rest_api/v1/serializers/group_configurations.py b/cms/djangoapps/contentstore/rest_api/v1/serializers/group_configurations.py index 3ea2e205fb69..fefeac8e748e 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/serializers/group_configurations.py +++ b/cms/djangoapps/contentstore/rest_api/v1/serializers/group_configurations.py @@ -12,6 +12,7 @@ class GroupConfigurationUsageSerializer(serializers.Serializer): label = serializers.CharField() url = serializers.CharField() + validation = serializers.DictField(required=False) class GroupConfigurationGroupSerializer(serializers.Serializer): @@ -21,7 +22,7 @@ class GroupConfigurationGroupSerializer(serializers.Serializer): id = serializers.IntegerField() name = serializers.CharField() - usage = GroupConfigurationUsageSerializer(allow_null=True, many=True) + usage = GroupConfigurationUsageSerializer(required=False, allow_null=True, many=True) version = serializers.IntegerField() @@ -34,6 +35,7 @@ class GroupConfigurationItemSerializer(serializers.Serializer): description = serializers.CharField() groups = GroupConfigurationGroupSerializer(allow_null=True, many=True) id = serializers.IntegerField() + usage = GroupConfigurationUsageSerializer(required=False, allow_null=True, many=True) name = serializers.CharField() parameters = serializers.DictField() read_only = serializers.BooleanField(required=False) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/group_configurations.py b/cms/djangoapps/contentstore/rest_api/v1/views/group_configurations.py index 919f7800f43a..49fc76850d6e 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/group_configurations.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/group_configurations.py @@ -59,6 +59,32 @@ def get(self, request: Request, course_id: str): ```json { "all_group_configurations": [ + { + "active": true, + "description": "Partition for segmenting users by enrollment track", + "groups": [ + { + "id": 2, + "name": "Enroll", + "usage": [ + { + "label": "Subsection / Unit", + "url": "/container/block-v1:org+101+101+type@vertical+block@08772238547242848cef9" + } + ], + "version": 1 + } + ], + "id": 50, + "usage": null, + "name": "Enrollment Track Groups", + "parameters": { + "course_id": "course-v1:org+101+101" + }, + "read_only": true, + "scheme": "enrollment_track", + "version": 3 + }, { "active": true, "description": "The groups in this configuration can be mapped to cohorts in the Instructor.", @@ -78,10 +104,38 @@ def get(self, request: Request, course_id: str): "version": 3 } ], - "experiment_group_configurations": null, + "experiment_group_configurations": [ + { + "active": true, + "description": "desc", + "groups": [ + { + "id": 276408623, + "name": "Group A", + "usage": null, + "version": 1 + }, + ... + ], + "id": 875961582, + "usage": [ + { + "label": "Unit / Content Experiment", + "url": "/container/block-v1:org+101+101+type@split_test+block@90ccbbad0dac48b18c5c80", + "validation": null + }, + ... + ], + "name": "Experiment Group Configurations 5", + "parameters": {}, + "scheme": "random", + "version": 3 + }, + ... + ], "mfe_proctored_exam_settings_url": "", - "should_show_enrollment_track": false, - "should_show_experiment_groups": false + "should_show_enrollment_track": true, + "should_show_experiment_groups": true, } ``` """