-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC] feat: flexible groups support proof of concept #32806
Conversation
Thanks for the pull request, @mariajgrimaldi! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. This is currently a draft pull request. When it is ready for our review and all tests are green, click "Ready for Review", or remove "WIP" from the title, as appropriate. |
Here's a script with the commands I used while testing this out: https://gist.github.com/mariajgrimaldi/96d79d3d7006d9c1116d3848454f60a0 It's documented with in-line docs so it's easier to understand. |
63ca4b0
to
fc0cd80
Compare
I'm closing this PR in favor of this more specific implementation, which connects teams to content groups: #33105 |
@mariajgrimaldi Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
1 similar comment
@mariajgrimaldi Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
Hi! I implemented a rough POC following up on the previous comment I left:
Technical rundown
First, we implemented this new group-type definition called CourseGroup or group for short as I will call it throughout this post. Don't mistake the new group-type with the current content groups.
This class is similar to the cohort's so it implements whatever we think would fit the class definition. For this POC, I added a reference to users I called professors.
The idea is to use this class as the cohort's, so we implemented a method to add groups to courses --ie. we simplified the cohort's one.
So for this to work, we need to add support for a new group-type to
CourseUserGroup
. As mentioned, we expected a smooth integration since the class' docstrings explained that other types could be added. SoCourseUserGroup
works with ourgroup
group type, we're adding a new GROUP_TYPE choice to be model here:Now, we create new migrations for the LMS.
Done! Here's how I created a new group type:
Where
get_course_groups
:Now, we need a way of adding students to our new group. Again, drawing inspiration from the cohort's implementation, we created an intermediate model that maps students and our new group type:
This model implements the
assign
method, which is used to assign users to cohorts or new group-types -- like in this case. We also implemented a method to add students to groups as part of the API :Here's how I used it:
This is what we currently have:
Now, to test out this approach, we implemented one of the use cases specified: content groups. To map users into content groups, we implemented the
GroupPartitionScheme
to define our new group type:groups
-- there are currently two, cohorts and random. This was implemented as a class in a Django plugin which was recognized as a new UserPartition by using theopenedx.user_partition_scheme
entry point:This is not a model, but instead the scheme that uses CourseUserGroup/GroupMembership and CourseUserGroupPartitionGroup to map learners into content groups. It implements two methods:
The most important method is
get_group_for_user
which:This method is broadly used to get the user's access to course content.
Here's the cohort's scheme methods where we heavily draw inspiration from. Basically, they're a more simplified version.
After installing the plugin that implements our new scheme into edx-platform (this plugin), the services now recognize our new scheme:
After some tweaking here and there in edx-platform so this new partition scheme was recognized, we managed to create new content groups associated with the new partition scheme:
Screencast.from.20-07-23.17.53.48.mp4
Notice how there are two content groups sections, the first associated with cohorts and the second one with groups! Also, we added course content to those content groups:
And tested with two different students, one belonging to
group 1
and the other one togroup 2
, so content groups are working with this new group-type.Now, what happens when I try adding a third student to both groups? This operation is allowed since our GroupMembership doesn't implement the uniqueness conditions. The main issue is that
.get
is broadly used throughout the implementation so we'll get errors like:WARNING!
Throughout this implementation, I used the word group as our new grouping mechanism but after testing it all out I realized how confusing it was so we should change the naming 😓