fix: add support to Group Configuration view for Teams partitions (#34643)

This commit is contained in:
Maria Grimaldi
2024-05-06 11:46:02 -04:00
committed by GitHub
parent 61b2870dff
commit b792222772
4 changed files with 12 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ from help_tokens.core import HelpUrlExpert
from lti_consumer.models import CourseAllowPIISharingInLTIFlag
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locator import LibraryLocator
from openedx.core.lib.teams_config import CONTENT_GROUPS_FOR_TEAMS, TEAM_SCHEME
from openedx_events.content_authoring.data import DuplicatedXBlockData
from openedx_events.content_authoring.signals import XBLOCK_DUPLICATED
from openedx_events.learning.data import CourseNotificationData
@@ -2146,6 +2147,12 @@ def get_group_configurations_context(course, store):
# Add it to the front of the list if it should be shown.
if should_show_enrollment_track:
displayable_partitions.insert(0, partition)
elif partition['scheme'] == TEAM_SCHEME:
should_show_team_partitions = len(partition['groups']) > 0 and CONTENT_GROUPS_FOR_TEAMS.is_enabled(
course_key
)
if should_show_team_partitions:
displayable_partitions.append(partition)
elif partition['scheme'] != RANDOM_SCHEME:
# Experiment group configurations are handled explicitly above. We don't
# want to display their groups twice.

View File

@@ -25,6 +25,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis
currentScheme = this.allGroupConfigurations[i].get('scheme');
this.allGroupViewList.push(
new PartitionGroupListView({
id: this.allGroupConfigurations[i].get('id'),
collection: this.allGroupConfigurations[i].get('groups'),
restrictEditing: this.allGroupConfigurations[i].get('read_only'),
scheme: currentScheme
@@ -43,7 +44,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis
// Render the remaining Configuration groups
for (i = 0; i < this.allGroupViewList.length; i++) {
currentClass = '.wrapper-groups.content-groups.' + this.allGroupViewList[i].scheme;
currentClass = `.wrapper-groups.content-groups.${this.allGroupViewList[i].scheme}.${this.allGroupViewList[i].id}`;
this.$(currentClass).append(this.allGroupViewList[i].render().el);
}

View File

@@ -54,7 +54,7 @@ from six.moves.urllib.parse import quote
<article class="content-primary" role="main">
% for config in all_group_configurations:
<div class="wrapper-groups content-groups ${config['scheme']}">
<div class="wrapper-groups content-groups ${config['scheme']} ${config['id']}">
<h3 class="title">${config['name']}</h3>
<div class="ui-loading">
<p><span class="spin"><span class="icon fa fa-refresh" aria-hidden="true"></span></span> <span class="copy">${_("Loading")}</span></p>

View File

@@ -64,6 +64,8 @@ class TeamPartitionScheme:
- A user is assigned to a group if they are a member of the team.
"""
read_only = True
@classmethod
def get_group_for_user(cls, course_key, user, user_partition):
"""Get the (Content) Group from the specified user partition for the user.