-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unit extensions API v2 for instructors dashboard #37783
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
base: master
Are you sure you want to change the base?
Unit extensions API v2 for instructors dashboard #37783
Conversation
|
Thanks for the pull request, @holaontiveros! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
b4b3387 to
55eef0e
Compare
|
|
||
| return extension_data | ||
|
|
||
| def list(self, request, *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps rather than override list, we could just override filter_queryset to return the queryset passed into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing list and not overriding filter_queryset works without error because there are no default filters in place. I think it would be good to explicitly set filter_backends = [] on the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't see this comment for some reason. I added filter_backends = []. Thanks
- Adjust tests for more consistent behavior - Add UnitDueDateExtension as a data interface - Reduce code duplication
|
@wgu-taylor-payne I believe I’ve addressed all the comments. Could you please take another look? |
| self.assertEqual(len(results), 2) | ||
|
|
||
| # If there are results, verify the structure | ||
| extension = results[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting instructor data for results[0]. Is that expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results[1] is the expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to figure out exactly what we expect in this test result. We set up the test class:
course (course)
chapter (section)
sequential (subsection) - Due Dec 31, 2024 # I don't think this original due date is used
vertical (unit)
problem
Before each test we setup:
# set users
add instructor, staff to course
enroll student1 and student2
# set due dates for course elements
sequential - Mar 22, 2019
vertical - Mar 23, 2019
problem - Mar 24, 2019
# set extensions
instructor - subsection - April 1, 2019 # are extensions typically set for instructors or is this just contrived?
student1 - vertical - April 2, 2019
student1 - subsection - April 2, 2019
student2 - problem - April 3, 2019
So, we set up four extensions on the course, and then we only get two back in the response:
{
"next": null,
"previous": null,
"count": 2,
"num_pages": 1,
"current_page": 1,
"start": 0,
"results": [
{
"username": "robot0",
"full_name": "Robot0 Instructor",
"email": "robot+test+0@edx.org",
"unit_title": "Homework 1",
"unit_location": "block-v1:edX+TestX+Test_Course+type@sequential+block@Homework_1",
"extended_due_date": "2019-04-01T00:00:00Z"
},
{
"username": "student1",
"full_name": "Robot2 Test",
"email": "student1@example.com",
"unit_title": "Homework 1",
"unit_location": "block-v1:edX+TestX+Test_Course+type@sequential+block@Homework_1",
"extended_due_date": "2019-04-02T00:00:00Z"
}
]
}Is that what we want? Coming into this test without much context around dates and extensions, it's a bit confusing to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted this important test to improve clarity. I also added comments to better explain the code. As far as I understand, the test should work as described below.
Setup
Course structure
- course
- chapter (section)
- vertical (unit)
- problem
- vertical (unit)
- chapter (section)
Users
- Add instructor and staff to the course
- Enroll
student1andstudent2
Due dates
- sequential: Dec 31, 2024
- vertical: Dec 31, 2024
- problem: Dec 31, 2024
Extensions
student1– subsection – Oct 31, 2025student2– subsection – Nov 30, 2025student2– subsection – Dec 31, 2025
Expected behavior
The first and third extensions should be included in the resulting list, because only the top-level unit with a due date (the subsection) is considered when determining which extensions apply.
wgu-taylor-payne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is one more suggestion I have.
wgu-taylor-payne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…enedx#37939) Referenced GH team names have been updated accordingly as well. Closes: openedx#37904
47a2097 to
511e8eb
Compare
Description
Supporting information
fixes #37664
Testing instructions
example curl to test, make sure you have the right cookies and update the right IDs and details
a possible valid example of response of the query looks like:
{ "next": null, "previous": null, "count": 2, "num_pages": 1, "current_page": 1, "start": 0, "results": [ { "username": "armando", "full_name": "", "email": "armando.ontiveros@wgu.edu", "unit_title": "Subsection", "unit_location": "block-v1:OEXCOM+101+2025_T1+type@sequential+block@c3ccd3d1f91b42dfb2bff8185dba4d3b", "extended_due_date": "2026-12-28T00:00:00Z" }, { "username": "javier", "full_name": "", "email": "javier.ontiveros@wgu.edu", "unit_title": "Subsection", "unit_location": "block-v1:OEXCOM+101+2025_T1+type@sequential+block@c3ccd3d1f91b42dfb2bff8185dba4d3b", "extended_due_date": "2025-12-12T12:12:00Z" } ] }Deadline
None
Other information
Include anything else that will help reviewers and consumers understand the change.